# AB = [list(map(int, input().split())) for i in range(3)]

paths = [[] for _ in range(4)]
for _ in range(3):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    paths[a].append(b)
    paths[b].append(a)

start = 0
for i in range(4):
    if len(paths[i]) == 1:
        start = i
        break

visited = {start}
def dfs(n):
    if len(paths[n]) >= 3:
        print('NO')
        exit()
    for p in paths[n]:
        if p in visited:
            continue
        visited.add(p)
        dfs(p)

dfs(start)

if len(visited) == 4:
    print('YES')
else:
    print('NO') [] for _ in range(4) for _ in range(4) _ range(4) range 4 for _ in range(4) [] paths = [[] for _ in range(4)] paths [[] for _ in range(4)] for _ in range(3):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    paths[a].append(b)
    paths[b].append(a) _ range(3) range 3 a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b a, b = a-1, b-1 a a-1 a 1 b b-1 b 1 paths[a].append(b) [a].append [a] paths a append b paths[b].append(a) [b].append [b] paths b append a start = 0 start 0 for i in range(4):
    if len(paths[i]) == 1:
        start = i
        break i range(4) range 4 if len(paths[i]) == 1:
        start = i
        break len(paths[i]) == 1 len(paths[i]) len paths[i] paths i 1 start = i start i break visited = {start} visited {start} def dfs(n):
    if len(paths[n]) >= 3:
        print('NO')
        exit()
    for p in paths[n]:
        if p in visited:
            continue
        visited.add(p)
        dfs(p) dfs if len(paths[n]) >= 3:
        print('NO')
        exit()
     len(paths[n]) >= 3 len(paths[n]) len paths[n] paths n 3 print('NO') print 'NO' exit() exit for p in paths[n]:
        if p in visited:
            continue
        visited.add(p)
        dfs(p) p paths[n] paths n if p in visited:
            continue
         p in visited p visited continue visited.add(p) visited.add visited add p dfs(p) dfs p n n dfs(start) dfs start if len(visited) == 4:
    print('YES')
else:
    print('NO') len(visited) == 4 len(visited) len visited 4 print('YES') print 'YES' print('NO') print 'NO' paths = [[] for _ in range(4)] [[] for _ in range(4)] paths a, b = map(int, input().split()) map(int, input().split()) a visited = {start} {start} visited start = i i start b = a-1, b-1 b-1 b b = map(int, input().split()) map(int, input().split()) b def dfs(n):
    if len(paths[n]) >= 3:
        print('NO')
        exit()
    for p in paths[n]:
        if p in visited:
            continue
        visited.add(p)
        dfs(p) def dfs(n):
    if len(paths[n]) >= 3:
        print('NO')
        exit()
    for p in paths[n]:
        if p in visited:
            continue
        visited.add(p)
        dfs(p) dfs a, b = a-1, b-1 a-1 a start = 0 0 start
# AB = [list(map(int, input().split())) for i in range(3)]

paths = [[] for _ in range(4)]
for _ in range(3):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    paths[a].append(b)
    paths[b].append(a)

start = 0
for i in range(4):
    if len(paths[i]) == 1:
        start = i
        break

visited = {start}
def dfs(n):
    if len(paths[n]) >= 3:
        print('NO')
        exit()
    for p in paths[n]:
        if p in visited:
            continue
        visited.add(p)
        dfs(p)

dfs(start)

if len(visited) == 4:
    print('YES')
else:
    print('NO')