def main(): A0 = tuple(map(int, input().split('.'))) A1 = tuple(map(int, input().split('.'))) for i, j in zip(A0, A1): if i < j: print('NO') break elif i > j: print('YES') break else: print('YES') main()