s=eval(input());print(('YNEOS'[sum(t in s for t in'1479')<4::2]))
print(('YNEOS'[set(eval(input()))!=set('1974 ')::2]))
s = eval(input())
print(("YNEOS"[sum(t in s for t in "1479") < 4 :: 2]))

print(("YNEOS"[set(eval(input())) != set("1974 ") :: 2]))

-s = eval(input()) -print(("YNEOS"[sum(t in s for t in "1479") < 4 :: 2])) +print(("YNEOS"[set(eval(input())) != set("1974 ") :: 2]))