t0 = str(input()) t1 = str(input()) a = t0.split(".") b = t1.split(".") count = 0 for i,v in enumerate(a): if v >= b[i]: count += 1 print("YES" if count >= 3 else "NO")