A0, B0, C0 = map(str, input().split('.')) A1, B1, C1 = map(str, input().split('.')) Version0 = f"{A0.zfill(3)}{B0.zfill(3)}{C0.zfill(3)}" Version1 = f"{A1.zfill(3)}{B1.zfill(3)}{C1.zfill(3)}" if Version0 >= Version1: print("YES") else: print("NO")