n = list(map(int, input().split()))



bl = True

for v in 1, 9, 7, 4:

    if v not in n:

        bl = False

        break



print(('YES' if bl else 'NO'))

n = list(map(int, input().split()))

n = sorted(n)



bl = (n[0] == 1 and n[1] == 4 and n[2] == 7 and n[3] == 9)

print(('YES' if bl else 'NO'))

n = list(map(int, input().split()))
bl = True
for v in 1, 9, 7, 4:
    if v not in n:
        bl = False
        break
print(("YES" if bl else "NO"))

n = list(map(int, input().split()))
n = sorted(n)
bl = n[0] == 1 and n[1] == 4 and n[2] == 7 and n[3] == 9
print(("YES" if bl else "NO"))

-bl = True -for v in 1, 9, 7, 4: -    if v not in n: -        bl = False -        break +n = sorted(n) +bl = n[0] == 1 and n[1] == 4 and n[2] == 7 and n[3] == 9