A=map(int,input().split('.')) B=map(int,input().split('.')) for x,y in zip(A,B): if x>y: print('YES') break else:print('NO')