a,b,c = list(map(int, input().split('.'))) x,y,z = list(map(int, input().split('.'))) def ton(a,b,c): return a * (1000) ** 2 + b * (1000) ** 1 + c old = ton(a,b,c) > ton(x,y,z) if old: print('YES') else: print('NO')