from itertools import permutations

ways = [tuple(map(int, input().split())) for _ in range(3)]
for p in permutations(ways, 3):
    path1 = [p[0][0], p[0][1]]; path2 = [p[0][1], p[0][0]]
    for i in range(1, 3):
        if path1[-1] in p[i]:
            a, b = p[i]; path1.append(a if path1[-1] == b else b)
        if path2[-1] in p[i]:
            a, b = p[i]; path2.append(a if path2[-1] == b else b)
    if max(len(path1), len(path2)) == 4: print('YES'); break;
else: print('NO') from itertools import permutations tuple(map(int, input().split())) for _ in range(3) for _ in range(3) _ range(3) range 3 for _ in range(3) tuple(map(int, input().split())) tuple map(int, input().split()) map int input().split() ().split () input split ways = [tuple(map(int, input().split())) for _ in range(3)] ways [tuple(map(int, input().split())) for _ in range(3)] for p in permutations(ways, 3):
    path1 = [p[0][0], p[0][1]]; path2 = [p[0][1], p[0][0]]
    for i in range(1, 3):
        if path1[-1] in p[i]:
            a, b = p[i]; path1.append(a if path1[-1] == b else b)
        if path2[-1] in p[i]:
            a, b = p[i]; path2.append(a if path2[-1] == b else b)
    if max(len(path1), len(path2)) == 4: print('YES'); break;
else: print('NO') p permutations(ways, 3) permutations ways 3 path1 = [p[0][0], p[0][1]] path1 [p[0][0], p[0][1]] p[0][0] [0] p 0 0 p[0][1] [0] p 0 1 path2 = [p[0][1], p[0][0]] path2 [p[0][1], p[0][0]] p[0][1] [0] p 0 1 p[0][0] [0] p 0 0 for i in range(1, 3):
        if path1[-1] in p[i]:
            a, b = p[i]; path1.append(a if path1[-1] == b else b)
        if path2[-1] in p[i]:
            a, b = p[i]; path2.append(a if path2[-1] == b else b)
     i range(1, 3) range 1 3 if path1[-1] in p[i]:
            a, b = p[i]; path1.append(a if path1[-1] == b else b)
         path1[-1] in p[i] path1[-1] path1 -1 p[i] p i a, b = p[i] a p[i] p i b path1.append(a if path1[-1] == b else b) path1.append path1 append a if path1[-1] == b else b path1[-1] == b path1[-1] path1 -1 b a b if path2[-1] in p[i]:
            a, b = p[i]; path2.append(a if path2[-1] == b else b)
     path2[-1] in p[i] path2[-1] path2 -1 p[i] p i a, b = p[i] a p[i] p i b path2.append(a if path2[-1] == b else b) path2.append path2 append a if path2[-1] == b else b path2[-1] == b path2[-1] path2 -1 b a b if max(len(path1), len(path2)) == 4: print('YES'); br max(len(path1), len(path2)) == 4 max(len(path1), len(path2)) max len(path1) len path1 len(path2) len path2 4 ways = [tuple(map(int, input().split())) for _ in range(3)] [tuple(map(int, input().split())) for _ in range(3)] ways b = p[i] p[i] b path1 = [p[0][0], p[0][1]] [p[0][0], p[0][1]] path1 a, b = p[i] p[i] a b = p[i] p[i] b a, b = p[i] p[i] a path2 = [p[0][1], p[0][0]] [p[0][1], p[0][0]] path2
from itertools import permutations

ways = [tuple(map(int, input().split())) for _ in range(3)]
for p in permutations(ways, 3):
    path1 = [p[0][0], p[0][1]]; path2 = [p[0][1], p[0][0]]
    for i in range(1, 3):
        if path1[-1] in p[i]:
            a, b = p[i]; path1.append(a if path1[-1] == b else b)
        if path2[-1] in p[i]:
            a, b = p[i]; path2.append(a if path2[-1] == b else b)
    if max(len(path1), len(path2)) == 4: print('YES'); break;
else: print('NO')