ab=[list(map(int, input().split())) for _ in range(3)]
ab=sum(ab,[])
if ab.count(1)>=3 or ab.count(2)>=3 or ab.count(3)>=3 or ab.count(4)>=3:
    print('NO')
else:
    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 ab=[list(map(int, input().split())) for _ in range(3)] ab [list(map(int, input().split())) for _ in range(3)] ab=sum(ab,[]) ab sum(ab,[]) sum ab [] if ab.count(1)>=3 or ab.count(2)>=3 or ab.count(3)>=3 or ab.count(4)>=3:
    print('NO')
else:
    print('YES') ab.count(1)>=3 or ab.count(2)>=3 or ab.count(3)>=3 or ab.count(4)>=3 ab.count(1)>=3 or ab.count(2)>=3 or ab.count(3)>=3 ab.count(1)>=3 or ab.count(2)>=3 ab.count(1)>=3 ab.count(1) ab.count ab count 1 3 ab.count(2)>=3 ab.count(2) ab.count ab count 2 3 ab.count(3)>=3 ab.count(3) ab.count ab count 3 3 ab.count(4)>=3 ab.count(4) ab.count ab count 4 3 print('NO') print 'NO' print('YES') print 'YES' ab=sum(ab,[]) sum(ab,[]) ab ab=[list(map(int, input().split())) for _ in range(3)] [list(map(int, input().split())) for _ in range(3)] ab
ab=[list(map(int, input().split())) for _ in range(3)]
ab=sum(ab,[])
if ab.count(1)>=3 or ab.count(2)>=3 or ab.count(3)>=3 or ab.count(4)>=3:
    print('NO')
else:
    print('YES')

