lis = [list(map(int, input().split())) for _ in range(3)]

n = [0]*4

for i in lis:
    n[i[0]-1] += 1
    n[i[1]-1] += 1

for j in n:
    if j >=3 or j ==0:
        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 lis = [list(map(int, input().split())) for _ in range(3)] lis [list(map(int, input().split())) for _ in range(3)] n = [0]*4 n [0]*4 [0] 0 4 for i in lis:
    n[i[0]-1] += 1
    n[i[1]-1] += 1 i lis n[i[0]-1] += 1 n[i[0]-1] n i[0]-1 i[0] i 0 1 1 n[i[1]-1] += 1 n[i[1]-1] n i[1]-1 i[1] i 1 1 1 for j in n:
    if j >=3 or j ==0:
        print('NO')
        exit() j n if j >=3 or j ==0:
        print('NO')
        exit() j >=3 or j ==0 j >=3 j 3 j ==0 j 0 print('NO') print 'NO' exit() exit print('YES') print 'YES' n = [0]*4 [0]*4 n lis = [list(map(int, input().split())) for _ in range(3)] [list(map(int, input().split())) for _ in range(3)] lis
lis = [list(map(int, input().split())) for _ in range(3)]

n = [0]*4

for i in lis:
    n[i[0]-1] += 1
    n[i[1]-1] += 1

for j in n:
    if j >=3 or j ==0:
        print('NO')
        exit()
print('YES')