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