a = [list(map(int,input().split())) for _ in range(3)]
for i in range(1,5):
  if i in a[0] and i in a[1] and i in a[2]:
    print('NO')
    exit()
print('YES') list(map(int,input().split())) for _ in range(3) for _ in range(3) _ range(3) range 3 for _ in range(3) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split a = [list(map(int,input().split())) for _ in range(3)] a [list(map(int,input().split())) for _ in range(3)] for i in range(1,5):
  if i in a[0] and i in a[1] and i in a[2]:
    print('NO')
    exit() i range(1,5) range 1 5 if i in a[0] and i in a[1] and i in a[2]:
    print('NO')
    exit() i in a[0] and i in a[1] and i in a[2] i in a[0] and i in a[1] i in a[0] i a[0] a 0 i in a[1] i a[1] a 1 i in a[2] i a[2] a 2 print('NO') print 'NO' exit() exit print('YES') print 'YES' a = [list(map(int,input().split())) for _ in range(3)] [list(map(int,input().split())) for _ in range(3)] a
a = [list(map(int,input().split())) for _ in range(3)]
for i in range(1,5):
  if i in a[0] and i in a[1] and i in a[2]:
    print('NO')
    exit()
print('YES')