#python 3.5.2 V0 = list(map(int, input().split("."))) V1 = list(map(int, input().split("."))) kaseki = False if V0[0] > V1[0]: kaseki = True elif V0[0] == V1[0]: if V0[1] > V1[1]: kaseki = True elif V0[1] == V1[1]: if V0[2] >= V1[2]: kaseki = True print("YES") if kaseki else print("NO")