a,b,c = map(int, input().split('.')) a_j,b_j,c_j = map(int, input().split('.')) if a > a_j: print('YES') elif a < a_j: print('NO') else: if b > b_j: print('YES') elif b < b_j: print('NO') else: if c >= c_j: print('YES') elif c < c_j: print('NO')