# -*- coding: utf-8 -*- OLD = map(int, raw_input().split(".")) NEW = map(int, raw_input().split(".")) for i in range(0, 3): if OLD[i] < NEW[i]: print "NO" exit() elif OLD[i] > NEW[i]: print "YES" exit() elif OLD[i] == NEW[i]: if i == 2: print "YES" exit()