a, b, c = map(int, input().split(".")) x, y, z = map(int, input().split(".")) if a < x: print("NO") elif a == x: if b < y: print("NO") elif b == y: if c < z: print("NO") else: print("YES") else: print("YES") else: print("YES")