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".
l = sorted(list(map(int,input().split())))

if l == [1, 4, 7, 9]:
  print('Yes')
else:
  print('No')
l = sorted(list(map(int,input().split())))

if l == [1, 4, 7, 9]:
  print('YES')
else:
  print('NO')
