A, B, C = map(int, input().split(".")) a, b, c = map(int, input().split(".")) ABC = "{:03}{:03}{:03}".format(A, B, C) abc = "{:03}{:03}{:03}".format(a, b, c) if ABC>=abc: print("YES") else: print("NO")