road=[0]*5
corr=[0,1,2,2,1]
for _ in range(3):
  a,b=map(int,input().split())
  road[a]+=1
  road[b]+=1
print("YES" if road==corr else "NO") road=[0]*5 road [0]*5 [0] 0 5 corr=[0,1,2,2,1] corr [0,1,2,2,1] 0 1 2 2 1 for _ in range(3):
  a,b=map(int,input().split())
  road[a]+=1
  road[b]+=1 _ range(3) range 3 a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b road[a]+=1 road[a] road a 1 road[b]+=1 road[b] road b 1 print("YES" if road==corr else "NO") print "YES" if road==corr else "NO" road==corr road corr "YES" "NO" a,b=map(int,input().split()) map(int,input().split()) a b=map(int,input().split()) map(int,input().split()) b road=[0]*5 [0]*5 road corr=[0,1,2,2,1] [0,1,2,2,1] corr
road=[0]*5
corr=[0,1,2,2,1]
for _ in range(3):
  a,b=map(int,input().split())
  road[a]+=1
  road[b]+=1
print("YES" if road==corr else "NO")
