print(("YNEOS"[eval(input())not in'357'::2]))
print(("YNEOS"[eval(input())in'124689'::2]))
print(("YNEOS"[eval(input()) not in "357" :: 2]))

print(("YNEOS"[eval(input()) in "124689" :: 2]))

-print(("YNEOS"[eval(input()) not in "357" :: 2])) +print(("YNEOS"[eval(input()) in "124689" :: 2]))