old = list(map(int, input().split('.'))) que = list(map(int, input().split('.'))) for i in range(3): if(old[i] < que[i]): print('NO') break elif(i == 2): print('YES')