s=eval(input());print(('YNEOS'[s.count('5')!=2or s.count('7')!=1::2]))
s=eval(input());z=s.count;print(('YNEOS'[z('5')!=2or z('7')!=1::2]))
s = eval(input())
print(("YNEOS"[s.count("5") != 2 or s.count("7") != 1 :: 2]))

s = eval(input())
z = s.count
print(("YNEOS"[z("5") != 2 or z("7") != 1 :: 2]))

-print(("YNEOS"[s.count("5") != 2 or s.count("7") != 1 :: 2])) +z = s.count +print(("YNEOS"[z("5") != 2 or z("7") != 1 :: 2]))