xs = list(map(int, input().split())) ys = list(map(int, input().split())) if sorted(xs) == sorted(ys): print('Yes') print(2) else: print('No')