import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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

    def dfs(v, p):
        for u in tree[v]:
            if u == p:
                continue
            elif visited[u]:
                return
            else:
                visited[u] = True
                dfs(u, v)
                return

    visited = [False] * 4
    visited[0] = True
    dfs(0, -1)
    print("YES" if visited.count(True) == 4 else "NO")


if __name__ == '__main__':
    resolve() import sys sys sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline f_inf = float('inf') f_inf float('inf') float 'inf' mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 def resolve():
    tree = [[] for _ in range(4)]
    for _ in range(3):
        a, b = map(int, input().split())
        tree[a - 1].append(b - 1)
        tree[b - 1].append(a - 1)

    def dfs(v, p):
        for u in tree[v]:
            if u == p:
                continue
            elif visited[u]:
                return
            else:
                visited[u] = True
                dfs(u, v)
                return

    visited = [False] * 4
    visited[0] = True
    dfs(0, -1)
    print("YES" if visited.count(True) == 4 else "NO") resolve [] for _ in range(4) for _ in range(4) _ range(4) range 4 for _ in range(4) [] tree = [[] for _ in range(4)] tree [[] for _ in range(4)] for _ in range(3):
        a, b = map(int, input().split())
        tree[a - 1].append(b - 1)
        tree[b - 1].append(a - 1)

     _ range(3) range 3 a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b tree[a - 1].append(b - 1) [a - 1].append [a - 1] tree a - 1 a 1 append b - 1 b 1 tree[b - 1].append(a - 1) [b - 1].append [b - 1] tree b - 1 b 1 append a - 1 a 1 def dfs(v, p):
        for u in tree[v]:
            if u == p:
                continue
            elif visited[u]:
                return
            else:
                visited[u] = True
                dfs(u, v)
                return

     dfs for u in tree[v]:
            if u == p:
                continue
            elif visited[u]:
                return
            else:
                visited[u] = True
                dfs(u, v)
                return

     u tree[v] tree v if u == p:
                continue
            elif visited[u]:
                return
            else:
                visited[u] = True
                dfs(u, v)
                return

     u == p u p continue elif visited[u]:
                return
             visited[u] visited u return visited[u] = True visited[u] visited u True dfs(u, v) dfs u v return v v p p visited = [False] * 4 visited [False] * 4 [False] False 4 visited[0] = True visited[0] visited 0 True dfs(0, -1) dfs 0 -1 print("YES" if visited.count(True) == 4 else "NO") print "YES" if visited.count(True) == 4 else "NO" visited.count(True) == 4 visited.count(True) visited.count visited count True 4 "YES" "NO" if __name__ == '__main__':
    resolve() __name__ == '__main__' __name__ '__main__' resolve() resolve def resolve():
    tree = [[] for _ in range(4)]
    for _ in range(3):
        a, b = map(int, input().split())
        tree[a - 1].append(b - 1)
        tree[b - 1].append(a - 1)

    def dfs(v, p):
        for u in tree[v]:
            if u == p:
                continue
            elif visited[u]:
                return
            else:
                visited[u] = True
                dfs(u, v)
                return

    visited = [False] * 4
    visited[0] = True
    dfs(0, -1)
    print("YES" if visited.count(True) == 4 else "NO") def resolve():
    tree = [[] for _ in range(4)]
    for _ in range(3):
        a, b = map(int, input().split())
        tree[a - 1].append(b - 1)
        tree[b - 1].append(a - 1)

    def dfs(v, p):
        for u in tree[v]:
            if u == p:
                continue
            elif visited[u]:
                return
            else:
                visited[u] = True
                dfs(u, v)
                return

    visited = [False] * 4
    visited[0] = True
    dfs(0, -1)
    print("YES" if visited.count(True) == 4 else "NO") resolve f_inf = float('inf') float('inf') f_inf mod = 10 ** 9 + 7 10 ** 9 + 7 mod input = sys.stdin.readline sys.stdin.readline input
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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

    def dfs(v, p):
        for u in tree[v]:
            if u == p:
                continue
            elif visited[u]:
                return
            else:
                visited[u] = True
                dfs(u, v)
                return

    visited = [False] * 4
    visited[0] = True
    dfs(0, -1)
    print("YES" if visited.count(True) == 4 else "NO")


if __name__ == '__main__':
    resolve()
