# -*- coding: utf-8 -*- a,b,c = map(int,input().split(".")) d,e,f = map(int,input().split(".")) if a > d: print("YES") elif a == d and b > e: print("YES") elif a == d and b == e and c >= f: print("YES") else: print("NO")