ls_1 = list(map(int, input().split('.'))) ls_2 = list(map(int, input().split('.'))) for i in range(len(ls_1)): if ls_1[i] > ls_2[i]: print('YES') break elif ls_1[i] < ls_2[i]: print('NO') break else: continue else: print('YES')