y,m,d = map(int,input().split()) y1,m1,d1 = map(int,input().split()) if y < y1: print('yes') elif y > y1: print('no') else: if m < m1: print('yes') elif m > m1: print('no') else: if m > m1: print('no') else: print('yes')