_, Y1, _, Y2, _ = map(int,input().split()) print('Yes' if Y1 == Y2 else 'No')