a = int(input())b = int(input())
def gcd(a, b):while b != 0:a, b = b, a % breturn a
if gcd(a, b) == 1:print("YES")else:print("NO")
a = int(input())
b = int(input())
def gcd(a, b):
while b != 0:
a, b = b, a % b
return a
if gcd(a, b) == 1:
print("YES")
else:
print("NO")