# Read the fossil version and target version fossil_version = list(map(int, input().split('.'))) target_version = list(map(int, input().split('.'))) # Compare the two version lists if target_version <= fossil_version: print("YES") else: print("NO")