a,b,c = list(map(int, input().split('.'))) x,y,z = list(map(int, input().split('.'))) old = False if a < x: old = False elif a > x: old = True else: if b < y: old = False elif b > y: old = True else: if c < z: old = False else: old = True if old: print('YES') else: print('NO')