from collections import defaultdict,deque

N = 4
d = defaultdict(list)
for i in range(3):
    a, b = map(int, input().split())
    d[a].append(b)
    d[b].append(a)


for i in range(1,5):
    dist = [None]*N
    q = deque()
    s = i  # スタート
    q.append(s)
    dist[s-1] = 0

    while len(q)!=0:
        From = q.popleft()
        for To in d[From]:
            if dist[To-1] == None:
                q.append(To)
                dist[To-1] = dist[From-1]+1
    if set(dist)=={0,1,2,3}:
        print("YES")
        exit()
print("NO") from collections import defaultdict,deque N = 4 N 4 d = defaultdict(list) d defaultdict(list) defaultdict list for i in range(3):
    a, b = map(int, input().split())
    d[a].append(b)
    d[b].append(a) i range(3) range 3 a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b d[a].append(b) [a].append [a] d a append b d[b].append(a) [b].append [b] d b append a for i in range(1,5):
    dist = [None]*N
    q = deque()
    s = i  # スタート
    q.append(s)
    dist[s-1] = 0

    while len(q)!=0:
        From = q.popleft()
        for To in d[From]:
            if dist[To-1] == None:
                q.append(To)
                dist[To-1] = dist[From-1]+1
    if set(dist)=={0,1,2,3}:
        print("YES")
        exit() i range(1,5) range 1 5 dist = [None]*N dist [None]*N [None] None N q = deque() q deque() deque s = i s i q.append(s) q.append q append s dist[s-1] = 0 dist[s-1] dist s-1 s 1 0 while len(q)!=0:
        From = q.popleft()
        for To in d[From]:
            if dist[To-1] == None:
                q.append(To)
                dist[To-1] = dist[From-1]+1
     len(q)!=0 len(q) len q 0 From = q.popleft() From q.popleft() q.popleft q popleft for To in d[From]:
            if dist[To-1] == None:
                q.append(To)
                dist[To-1] = dist[From-1]+1
     To d[From] d From if dist[To-1] == None:
                q.append(To)
                dist[To-1] = dist[From-1]+1
     dist[To-1] == None dist[To-1] dist To-1 To 1 None q.append(To) q.append q append To dist[To-1] = dist[From-1]+1 dist[To-1] dist To-1 To 1 dist[From-1]+1 dist[From-1] dist From-1 From 1 1 if set(dist)=={0,1,2,3}:
        print("YES")
        exit() set(dist)=={0,1,2,3} set(dist) set dist {0,1,2,3} print("YES") print "YES" exit() exit print("NO") print "NO" N = 4 4 N a, b = map(int, input().split()) map(int, input().split()) a dist = [None]*N [None]*N dist s = i i s From = q.popleft() q.popleft() From d = defaultdict(list) defaultdict(list) d b = map(int, input().split()) map(int, input().split()) b q = deque() deque() q
from collections import defaultdict,deque

N = 4
d = defaultdict(list)
for i in range(3):
    a, b = map(int, input().split())
    d[a].append(b)
    d[b].append(a)


for i in range(1,5):
    dist = [None]*N
    q = deque()
    s = i  # スタート
    q.append(s)
    dist[s-1] = 0

    while len(q)!=0:
        From = q.popleft()
        for To in d[From]:
            if dist[To-1] == None:
                q.append(To)
                dist[To-1] = dist[From-1]+1
    if set(dist)=={0,1,2,3}:
        print("YES")
        exit()
print("NO")