def f(): return map(int, input().split(('.'))) A, B, C = f() a, b, c = f() print(['NO', 'YES'][10000*A+100*B+C > 10000*a+100*b+c])