P = input() Q = input() p = P.split(".") q = Q.split(".") a = ''.join(p) b = ''.join(q) if a[0] < b[0] : print("NO") else : print("YES")