arr = list(map(int, input().split()))
flg = 0
for i in range(2):
  a,b = map(int, input().split())
  if arr[0] == a:
    arr.insert(0,b)
  elif arr[0] == b:
    arr.insert(0,a)
  elif arr[-1] == a:
    arr.append(b)
  elif arr[-1] == b:
    arr.append(a)
  elif i == 0:
    flg = 1
if len(arr) == 4 or flg == 1:
  print('YES')
else:
  print('NO') arr = list(map(int, input().split())) arr list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split flg = 0 flg 0 for i in range(2):
  a,b = map(int, input().split())
  if arr[0] == a:
    arr.insert(0,b)
  elif arr[0] == b:
    arr.insert(0,a)
  elif arr[-1] == a:
    arr.append(b)
  elif arr[-1] == b:
    arr.append(a)
  elif i == 0:
    flg = 1 i range(2) range 2 a,b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b if arr[0] == a:
    arr.insert(0,b)
  elif arr[0] == b:
    arr.insert(0,a)
  elif arr[-1] == a:
    arr.append(b)
  elif arr[-1] == b:
    arr.append(a)
  elif i == 0:
    flg = 1 arr[0] == a arr[0] arr 0 a arr.insert(0,b) arr.insert arr insert 0 b elif arr[0] == b:
    arr.insert(0,a)
   arr[0] == b arr[0] arr 0 b arr.insert(0,a) arr.insert arr insert 0 a elif arr[-1] == a:
    arr.append(b)
   arr[-1] == a arr[-1] arr -1 a arr.append(b) arr.append arr append b elif arr[-1] == b:
    arr.append(a)
   arr[-1] == b arr[-1] arr -1 b arr.append(a) arr.append arr append a elif i == 0:
    flg = 1 i == 0 i 0 flg = 1 flg 1 if len(arr) == 4 or flg == 1:
  print('YES')
else:
  print('NO') len(arr) == 4 or flg == 1 len(arr) == 4 len(arr) len arr 4 flg == 1 flg 1 print('YES') print 'YES' print('NO') print 'NO' b = map(int, input().split()) map(int, input().split()) b a,b = map(int, input().split()) map(int, input().split()) a arr = list(map(int, input().split())) list(map(int, input().split())) arr flg = 0 0 flg flg = 1 1 flg
arr = list(map(int, input().split()))
flg = 0
for i in range(2):
  a,b = map(int, input().split())
  if arr[0] == a:
    arr.insert(0,b)
  elif arr[0] == b:
    arr.insert(0,a)
  elif arr[-1] == a:
    arr.append(b)
  elif arr[-1] == b:
    arr.append(a)
  elif i == 0:
    flg = 1
if len(arr) == 4 or flg == 1:
  print('YES')
else:
  print('NO')