a = list(map(int, input().split('.'))) b = list(map(int, input().split('.'))) l = [] for i in range(3): if a[i] - b [i] > 0: print('NO') break elif a[i] - b [i] < 0: print('YES') break else: print('YES')