def main():
    N = 4
    edge = [[] for _ in range(N)]
    for i in range(N-1):
        a, b = (int(i) for i in input().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)
    even, odd = 0, 0
    for e in edge:
        if len(e) % 2 == 1:
            odd += 1
        else:
            even += 1
    if odd == 2 and even == 2:
        print("YES")
    else:
        print("NO")


if __name__ == '__main__':
    main() def main():
    N = 4
    edge = [[] for _ in range(N)]
    for i in range(N-1):
        a, b = (int(i) for i in input().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)
    even, odd = 0, 0
    for e in edge:
        if len(e) % 2 == 1:
            odd += 1
        else:
            even += 1
    if odd == 2 and even == 2:
        print("YES")
    else:
        print("NO") main N = 4 N 4 [] for _ in range(N) for _ in range(N) _ range(N) range N for _ in range(N) [] edge = [[] for _ in range(N)] edge [[] for _ in range(N)] for i in range(N-1):
        a, b = (int(i) for i in input().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)
     i range(N-1) range N-1 N 1 int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a, b = (int(i) for i in input().split()) a (int(i) for i in input().split()) b edge[a-1].append(b-1) [a-1].append [a-1] edge a-1 a 1 append b-1 b 1 edge[b-1].append(a-1) [b-1].append [b-1] edge b-1 b 1 append a-1 a 1 even, odd = 0, 0 even 0 odd 0 for e in edge:
        if len(e) % 2 == 1:
            odd += 1
        else:
            even += 1
     e edge if len(e) % 2 == 1:
            odd += 1
        else:
            even += 1
     len(e) % 2 == 1 len(e) % 2 len(e) len e 2 1 odd += 1 odd 1 even += 1 even 1 if odd == 2 and even == 2:
        print("YES")
    else:
        print("NO") odd == 2 and even == 2 odd == 2 odd 2 even == 2 even 2 print("YES") print "YES" print("NO") print "NO" if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    N = 4
    edge = [[] for _ in range(N)]
    for i in range(N-1):
        a, b = (int(i) for i in input().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)
    even, odd = 0, 0
    for e in edge:
        if len(e) % 2 == 1:
            odd += 1
        else:
            even += 1
    if odd == 2 and even == 2:
        print("YES")
    else:
        print("NO") def main():
    N = 4
    edge = [[] for _ in range(N)]
    for i in range(N-1):
        a, b = (int(i) for i in input().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)
    even, odd = 0, 0
    for e in edge:
        if len(e) % 2 == 1:
            odd += 1
        else:
            even += 1
    if odd == 2 and even == 2:
        print("YES")
    else:
        print("NO") main
def main():
    N = 4
    edge = [[] for _ in range(N)]
    for i in range(N-1):
        a, b = (int(i) for i in input().split())
        edge[a-1].append(b-1)
        edge[b-1].append(a-1)
    even, odd = 0, 0
    for e in edge:
        if len(e) % 2 == 1:
            odd += 1
        else:
            even += 1
    if odd == 2 and even == 2:
        print("YES")
    else:
        print("NO")


if __name__ == '__main__':
    main()
