a,b=map(int,input().split())
c,d=map(int,input().split())
e,f=map(int,input().split())
L=[a,b,c,d,e,f]
R=set(L)
if len(R)==4 and L.count(1)<3 and L.count(4)<3 and L.count(3)<3 and L.count(2)<3:
  print("YES")
else:
  print("NO") a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b c,d=map(int,input().split()) c map(int,input().split()) map int input().split() ().split () input split d e,f=map(int,input().split()) e map(int,input().split()) map int input().split() ().split () input split f L=[a,b,c,d,e,f] L [a,b,c,d,e,f] a b c d e f R=set(L) R set(L) set L if len(R)==4 and L.count(1)<3 and L.count(4)<3 and L.count(3)<3 and L.count(2)<3:
  print("YES")
else:
  print("NO") len(R)==4 and L.count(1)<3 and L.count(4)<3 and L.count(3)<3 and L.count(2)<3 len(R)==4 and L.count(1)<3 and L.count(4)<3 and L.count(3)<3 len(R)==4 and L.count(1)<3 and L.count(4)<3 len(R)==4 and L.count(1)<3 len(R)==4 len(R) len R 4 L.count(1)<3 L.count(1) L.count L count 1 3 L.count(4)<3 L.count(4) L.count L count 4 3 L.count(3)<3 L.count(3) L.count L count 3 3 L.count(2)<3 L.count(2) L.count L count 2 3 print("YES") print "YES" print("NO") print "NO" a,b=map(int,input().split()) map(int,input().split()) a d=map(int,input().split()) map(int,input().split()) d b=map(int,input().split()) map(int,input().split()) b L=[a,b,c,d,e,f] [a,b,c,d,e,f] L f=map(int,input().split()) map(int,input().split()) f c,d=map(int,input().split()) map(int,input().split()) c e,f=map(int,input().split()) map(int,input().split()) e R=set(L) set(L) R
a,b=map(int,input().split())
c,d=map(int,input().split())
e,f=map(int,input().split())
L=[a,b,c,d,e,f]
R=set(L)
if len(R)==4 and L.count(1)<3 and L.count(4)<3 and L.count(3)<3 and L.count(2)<3:
  print("YES")
else:
  print("NO")