ab = [list(map(int, input().split())) for i in range(3)]
one, two, three, four = 0, 0, 0, 0
for i in ab:
    one += i.count(1)
    two += i.count(2)
    three += i.count(3)
    four += i.count(4)
if one == 3 or two == 3 or three == 3 or four == 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 ab = [list(map(int, input().split())) for i in range(3)] ab [list(map(int, input().split())) for i in range(3)] one, two, three, four = 0, 0, 0, 0 one 0 two 0 three 0 four 0 for i in ab:
    one += i.count(1)
    two += i.count(2)
    three += i.count(3)
    four += i.count(4) i ab one += i.count(1) one i.count(1) i.count i count 1 two += i.count(2) two i.count(2) i.count i count 2 three += i.count(3) three i.count(3) i.count i count 3 four += i.count(4) four i.count(4) i.count i count 4 if one == 3 or two == 3 or three == 3 or four == 3:
    print("NO")
else:
    print("YES") one == 3 or two == 3 or three == 3 or four == 3 one == 3 or two == 3 or three == 3 one == 3 or two == 3 one == 3 one 3 two == 3 two 3 three == 3 three 3 four == 3 four 3 print("NO") print "NO" print("YES") print "YES" four = 0, 0, 0, 0 0 four three += i.count(3) i.count(3) three ab = [list(map(int, input().split())) for i in range(3)] [list(map(int, input().split())) for i in range(3)] ab four += i.count(4) i.count(4) four one, two, three, four = 0, 0, 0, 0 0 one three, four = 0, 0, 0, 0 0 three two, three, four = 0, 0, 0, 0 0 two two += i.count(2) i.count(2) two one += i.count(1) i.count(1) one
ab = [list(map(int, input().split())) for i in range(3)]
one, two, three, four = 0, 0, 0, 0
for i in ab:
    one += i.count(1)
    two += i.count(2)
    three += i.count(3)
    four += i.count(4)
if one == 3 or two == 3 or three == 3 or four == 3:
    print("NO")
else:
    print("YES")