print([i*1000+j*100+m*10+n for i in [1,2,3,4] for j in [1,2,3,4] for m in [1,2,3,4] for n in [1,2,3,4] if i!=j and j!=m and m!=n and n!=i and i!=m and j!=n and 0 not in [(i*1000+j*100+m*10+n)%d for d in range(2,int(pow(i*1000+j*100+m*10+n, 0.5)+1))]])