lis = []
for i in range(3):
  lis = lis + list(map(int, input().split()))
#print(lis)

ans = "YES"

for i in range(4):
  a = lis.count(i+1)
  if a >= 3:
    ans = "NO"
    break
print(ans) lis = [] lis [] for i in range(3):
  lis = lis + list(map(int, input().split()))
#print(lis) i range(3) range 3 lis = lis + list(map(int, input().split())) lis lis + list(map(int, input().split())) lis list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = "YES" ans "YES" for i in range(4):
  a = lis.count(i+1)
  if a >= 3:
    ans = "NO"
    break i range(4) range 4 a = lis.count(i+1) a lis.count(i+1) lis.count lis count i+1 i 1 if a >= 3:
    ans = "NO"
    break a >= 3 a 3 ans = "NO" ans "NO" break print(ans) print ans lis = lis + list(map(int, input().split())) lis + list(map(int, input().split())) lis lis = [] [] lis a = lis.count(i+1) lis.count(i+1) a ans = "NO" "NO" ans ans = "YES" "YES" ans
lis = []
for i in range(3):
  lis = lis + list(map(int, input().split()))
#print(lis)

ans = "YES"

for i in range(4):
  a = lis.count(i+1)
  if a >= 3:
    ans = "NO"
    break
print(ans)