a = list(input().split())
a1 = list(input().split())
m = a[1]
m1 = a1[1]
m = '0'+m if int(m)<10 else m
m1 = '0'+m1 if int(m1)<10 else m1
x = int(''.join(a))
y = int(''.join(a1))
if x <= y:
print('yes')
else:
print('no')
a = list(input().split())
a1 = list(input().split())
m = a[1]
m1 = a1[1]
m = '0'+m if int(m)<10 else m
m1 = '0'+m1 if int(m1)<10 else m1
x = int(''.join(a))
y = int(''.join(a1))
if x <= y:
print('yes')
else:
print('no')