#!/usr/bin/python # -*- coding: utf-8 -*- kaseki = map(int, raw_input().split(".")) obj = map(int, raw_input().split(".")) for i in xrange(3): if obj[i] < kaseki[i]: print "YES" exit() elif obj[i] > kaseki[i]: print "NO" exit() if i == 2 and obj[i] == kaseki[i]: print "YES" exit() else: print "NO"