a=[int(i) for i in input().split(".")] b=[int(i) for i in input().split(".")] for i in range(3): if a[i]>b[i]: print("YES") break elif a[i]