You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
N = list(map(int,input().split()))
N.sort()
print("Yes" if N[0]*1000+N[1]*100+N[2]*10+N[3] == 1974 else "No")
N = list(map(int,input().split()))
N.sort()
print("YES" if N[0]*1000+N[1]*100+N[2]*10+N[3] == 1479 else "NO")
