# -*- coding: utf-8 -*- A = map(int, raw_input().split(".")) X = map(int, raw_input().split(".")) assert all(0 <= x <= 100 for x in A) assert all(0 <= x <= 100 for x in X) # WAč§£ for i in xrange(3): if A[i] < X[i]: print "NO" break else: print "YES"