A0,B0,C0 = map(int,input().split('.')) A,B,C = map(int,input().split('.')) if A0 < A: print('NO') exit() if A0 == A: if B0 < B: print('NO') exit() if B0==B: if C0 < C: print('NO') else: print('YES') else: print('YES') else: print('YES')