s = input().split('.') t = input().split('.') s = list(map(int,s)) t = list(map(int,t)) # print(s) # print(t) s = s[0] * 10000 + s[1]*100 + s[2] t = t[0] * 10000 + t[1]*100 + t[2] if t <= s: print('YES') else: print('NO')