a1,b1,c1=input().split('.') a2,b2,c2=input().split('.') if a1>=a2 and b1>=b2 and c1>=c2: print('YES') else: print('NO')