a,b=[list(map(int, input().split('.'))) for _ in '11'] for i in range(3): if a[i]>b[i]: print('YES');exit() elif a[i]