#import sys;input = lambda: sys.stdin.readline().rstrip()
#import heapq
#from collections import deque
#import numpy as np
#from collections import Counter as cnt
#from collections import defaultdict as ddc
#from math import factorial as fct
#from math import gcd
#from bisect import bisect_left as bsl
#from bisect import bisect_right as bsr
#from itertools import accumulate as acc
#from itertools import combinations as cmb
#from itertools import permutations as pmt
#from itertools import product as prd
#from functools import reduce as red
#import sys
#sys.setrecursionlimit(10**9)  #再帰を多く使う(デフォルトは1000)

# = input()
# = int(input())
# = map(int,input().split())
AA = list(map(int,input().split()))
BB = list(map(int,input().split()))
b = 1
for i in range(3):
    for j in range(3):
        A = [aa for aa in AA]
        B = [bb for bb in BB]
        A[i], B[j] = B[j], A[i]
        if len(set(A)) == len(set(B)) == 3:
            if A[1] in {min(A), max(A)} and B[1] in {min(B), max(B)}:
                b = 0
                break
print('YNeos'[b::2])
#print('YNEOS'[b::2])