s = [list(map(int, input().split())) for _ in range(3)]
flag = 0
cnt = 0
for i in range(1, 5):
    for j in s:
        if (j[0] == i) or (j[1] == i):
            cnt += 1
    if cnt == 3:
        flag = 1
        break
    else:
        cnt = 0
        continue

if flag == 1:
    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 s = [list(map(int, input().split())) for _ in range(3)] s [list(map(int, input().split())) for _ in range(3)] flag = 0 flag 0 cnt = 0 cnt 0 for i in range(1, 5):
    for j in s:
        if (j[0] == i) or (j[1] == i):
            cnt += 1
    if cnt == 3:
        flag = 1
        break
    else:
        cnt = 0
        continue i range(1, 5) range 1 5 for j in s:
        if (j[0] == i) or (j[1] == i):
            cnt += 1
     j s if (j[0] == i) or (j[1] == i):
            cnt += 1
     (j[0] == i) or (j[1] == i) j[0] == i j[0] j 0 i j[1] == i j[1] j 1 i cnt += 1 cnt 1 if cnt == 3:
        flag = 1
        break
    else:
        cnt = 0
        continue cnt == 3 cnt 3 flag = 1 flag 1 break cnt = 0 cnt 0 continue if flag == 1:
    print('NO')
else:
    print('YES') flag == 1 flag 1 print('NO') print 'NO' print('YES') print 'YES' cnt += 1 1 cnt s = [list(map(int, input().split())) for _ in range(3)] [list(map(int, input().split())) for _ in range(3)] s flag = 0 0 flag cnt = 0 0 cnt flag = 1 1 flag cnt = 0 0 cnt
s = [list(map(int, input().split())) for _ in range(3)]
flag = 0
cnt = 0
for i in range(1, 5):
    for j in s:
        if (j[0] == i) or (j[1] == i):
            cnt += 1
    if cnt == 3:
        flag = 1
        break
    else:
        cnt = 0
        continue

if flag == 1:
    print('NO')
else:
    print('YES')
