a = [[]]*3
for i in range(3):
  a[i] = list(map(int, input().split()))

cnt = 0
for i in range(1,5):
  tmp = 0
  for j in range(3):
    tmp += a[j].count(i) 
  if tmp == 2:
    cnt += 1

if cnt == 2:
  print("YES")
else:
  print("NO") a = [[]]*3 a [[]]*3 [[]] [] 3 for i in range(3):
  a[i] = list(map(int, input().split())) i range(3) range 3 a[i] = list(map(int, input().split())) a[i] a i list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split cnt = 0 cnt 0 for i in range(1,5):
  tmp = 0
  for j in range(3):
    tmp += a[j].count(i) 
  if tmp == 2:
    cnt += 1 i range(1,5) range 1 5 tmp = 0 tmp 0 for j in range(3):
    tmp += a[j].count(i) 
   j range(3) range 3 tmp += a[j].count(i) tmp a[j].count(i) [j].count [j] a j count i if tmp == 2:
    cnt += 1 tmp == 2 tmp 2 cnt += 1 cnt 1 if cnt == 2:
  print("YES")
else:
  print("NO") cnt == 2 cnt 2 print("YES") print "YES" print("NO") print "NO" tmp += a[j].count(i) a[j].count(i) tmp cnt += 1 1 cnt tmp = 0 0 tmp a = [[]]*3 [[]]*3 a cnt = 0 0 cnt
a = [[]]*3
for i in range(3):
  a[i] = list(map(int, input().split()))

cnt = 0
for i in range(1,5):
  tmp = 0
  for j in range(3):
    tmp += a[j].count(i) 
  if tmp == 2:
    cnt += 1

if cnt == 2:
  print("YES")
else:
  print("NO")