l = [list(map(int,input().split())) for i in range(3)]
a,b = [list(i) for i in zip(*l)]
t = [0] * 4

for i in range(3):
    t[a[i] - 1] += 1
    t[b[i] - 1] += 1

if max(t) == 3:
    print('NO')
else:
    print('YES') list(map(int,input().split())) for i in range(3) for i in range(3) i range(3) range 3 for i in range(3) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split l = [list(map(int,input().split())) for i in range(3)] l [list(map(int,input().split())) for i in range(3)] list(i) for i in zip(*l) for i in zip(*l) i zip(*l) zip *l l for i in zip(*l) list(i) list i a,b = [list(i) for i in zip(*l)] a [list(i) for i in zip(*l)] b t = [0] * 4 t [0] * 4 [0] 0 4 for i in range(3):
    t[a[i] - 1] += 1
    t[b[i] - 1] += 1 i range(3) range 3 t[a[i] - 1] += 1 t[a[i] - 1] t a[i] - 1 a[i] a i 1 1 t[b[i] - 1] += 1 t[b[i] - 1] t b[i] - 1 b[i] b i 1 1 if max(t) == 3:
    print('NO')
else:
    print('YES') max(t) == 3 max(t) max t 3 print('NO') print 'NO' print('YES') print 'YES' a,b = [list(i) for i in zip(*l)] [list(i) for i in zip(*l)] a b = [list(i) for i in zip(*l)] [list(i) for i in zip(*l)] b t = [0] * 4 [0] * 4 t l = [list(map(int,input().split())) for i in range(3)] [list(map(int,input().split())) for i in range(3)] l
l = [list(map(int,input().split())) for i in range(3)]
a,b = [list(i) for i in zip(*l)]
t = [0] * 4

for i in range(3):
    t[a[i] - 1] += 1
    t[b[i] - 1] += 1

if max(t) == 3:
    print('NO')
else:
    print('YES')