Problem:
Score : 200 points

Problem Statement

There are four towns, numbered 1,2,3 and 4.
Also, there are three roads. The i-th road connects different towns a_i and b_i bidirectionally.
No two roads connect the same pair of towns. Other than these roads, there is no way to travel between these towns, but any town can be reached from any other town using these roads.

Determine if we can visit all the towns by traversing each of the roads exactly once.

Constraints

1 \leq a_i,b_i \leq 4(1\leq i\leq 3)

a_i and b_i are different. (1\leq i\leq 3)

No two roads connect the same pair of towns.

Any town can be reached from any other town using the roads.

Input

Input is given from Standard Input in the following format:

a_1 b_1
a_2 b_2
a_3 b_3

Output

If we can visit all the towns by traversing each of the roads exactly once, print YES; otherwise, print NO.

Sample Input 1

4 2
1 3
2 3

Sample Output 1

YES

We can visit all the towns in the order 1,3,2,4.

Sample Input 2

3 2
2 4
1 2

Sample Output 2

NO

Sample Input 3

2 1
3 2
4 3

Sample Output 3

YES

Solution in C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;

using Cons = System.Console;

class PriorityQueue<T>
{
    private readonly List<T> m_list;
    private readonly Func<T, T, int> m_compare;
    private int m_count;
    public PriorityQueue(int capacity, Func<T, T, int> compare)
    {
        m_list = new List<T>(capacity);
        m_compare = compare;
        m_count = 0;
    }
    private int Add(T value)
    {
        if (m_count == m_list.Count)
        {
            m_list.Add(value);
        }
        else
        {
            m_list[m_count] = value;
        }
        return m_count++;
    }
    private void Swap(int a, int b)
    {
        T tmp = m_list[a];
        m_list[a] = m_list[b];
        m_list[b] = tmp;
    }
    public void Enqueue(T value)
    {
        int c = Add(value);
        while (c > 0)
        {
            int p = (c - 1) / 2;
            if (m_compare(m_list[c], m_list[p]) < 0) { Swap(p, c); } else { break; }
            c = p;
        }
    }
    public T Dequeue()
    {
        T value = m_list[0];
        m_list[0] = m_list[--m_count];
        int p = 0;
        while (true)
        {
            int c1 = p * 2 + 1;
            int c2 = p * 2 + 2;
            if (c1 >= m_count) { break; }
            int c = (c2 >= m_count || m_compare(m_list[c1], m_list[c2]) < 0) ? c1 : c2;
            if (m_compare(m_list[c], m_list[p]) < 0) { Swap(p, c); } else { break; }
            p = c;
        }
        return value;
    }
}

class Program
{
    static int Main(string[] args)
    {
        var sw = new StreamWriter(Cons.OpenStandardOutput()){AutoFlush = false};
        Cons.SetOut(sw);

        int ret = Solve();
        Cons.Out.Flush();

        return ret;
    }

    static int Solve()
    {
        int[] L = new int[4];
        for(int i = 0; i < 3; i++)
        {
            List<int> list = Console.ReadLine().Split(' ').Select(str => int.Parse(str)).ToList();
            L[list[0] - 1]++;
            L[list[1] - 1]++;
        }

        if(L.Max() == 3) Cons.WriteLine("No");
        else Cons.WriteLine("Yes");

        return 0;
    }
}