n = input() m = input() n = n.split(".") m = m.split(".") if int(n[0]) < int(m[0]): print("NO") elif int(n[0]) > int(m[0]): print("YES") elif int(n[1]) < int(m[1]): print("NO") elif int(n[1]) > int(m[1]): print("YES") elif int(n[2]) < int(m[2]): print("NO") elif int(n[2]) > int(m[2]): print("YES") else: print("YES")