def get_version(a, b, c): return int(a * 10 ** 6 + b * 10 ** 3 + c) fa, fb, fc = map(int, input().split(".")) a, b, c = map(int, input().split(".")) fversion = get_version(fa, fb, fc) version = get_version(a, b, c) if version <= fversion: print("YES") else: print("NO")