ret = []
for i in range(3):
  ret+=list(map(int,input().split()))
ret.sort()
if ret.count(1)==3 or ret.count(2)==3 or ret.count(3)==3 or ret.count(4)==3:
  print('NO')
else:
  print('YES') ret = [] ret [] for i in range(3):
  ret+=list(map(int,input().split())) i range(3) range 3 ret+=list(map(int,input().split())) ret list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split ret.sort() ret.sort ret sort if ret.count(1)==3 or ret.count(2)==3 or ret.count(3)==3 or ret.count(4)==3:
  print('NO')
else:
  print('YES') ret.count(1)==3 or ret.count(2)==3 or ret.count(3)==3 or ret.count(4)==3 ret.count(1)==3 or ret.count(2)==3 or ret.count(3)==3 ret.count(1)==3 or ret.count(2)==3 ret.count(1)==3 ret.count(1) ret.count ret count 1 3 ret.count(2)==3 ret.count(2) ret.count ret count 2 3 ret.count(3)==3 ret.count(3) ret.count ret count 3 3 ret.count(4)==3 ret.count(4) ret.count ret count 4 3 print('NO') print 'NO' print('YES') print 'YES' ret = [] [] ret ret+=list(map(int,input().split())) list(map(int,input().split())) ret
ret = []
for i in range(3):
  ret+=list(map(int,input().split()))
ret.sort()
if ret.count(1)==3 or ret.count(2)==3 or ret.count(3)==3 or ret.count(4)==3:
  print('NO')
else:
  print('YES')