def get():return list(map(int, input().split("."))) old_ver = get() ver1 = get() for i in range(3): if old_ver[i] != ver1[i]: print("YNEOS"[1 if old_ver[i] < ver1[i] else 0::2]) break