A = list(map(int, input().split())) for x in [12, 21, 102, 120, 201, 210]: i, j, k = x//100, x%100//10, x%10 if not A[j] % 2 and not A[k] % 3: print("Yes") break else: print("No")