Problem:
Score : 500 points

Problem Statement

Takahashi is not good at problems about trees in programming contests, and Aoki is helping him practice.

First, Takahashi created a tree with N vertices numbered 1 through N, and wrote 0 at each edge.

Then, Aoki gave him M queries. The i-th of them is as follows:

Increment the number written at each edge along the path connecting vertices a_i and b_i, by one.

After Takahashi executed all of the queries, he told Aoki that, for every edge, the written number became an even number.
However, Aoki forgot to confirm that the graph Takahashi created was actually a tree, and it is possible that Takahashi made a mistake in creating a tree or executing queries.

Determine whether there exists a tree that has the property mentioned by Takahashi.

Constraints

2 ≤ N ≤ 10^5

1 ≤ M ≤ 10^5

1 ≤ a_i,b_i ≤ N

a_i ≠ b_i

Input

Input is given from Standard Input in the following format:

N M
a_1 b_1
:
a_M b_M

Output

Print YES if there exists a tree that has the property mentioned by Takahashi; print NO otherwise.

Sample Input 1

4 4
1 2
2 4
1 3
3 4

Sample Output 1

YES

For example, Takahashi's graph has the property mentioned by him if it has the following edges: 1-2, 1-3 and 1-4.
In this case, the number written at every edge will become 2.

Sample Input 2

5 5
1 2
3 5
5 1
3 4
2 3

Sample Output 2

NO

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

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

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            AGC014.B();
        }

        class AGC014
        {
            public static void A()
            {
                var A = Read.Long();
                var B = Read.Long();
                var C = Read.Long();
                if (A == B && B == C) { Console.WriteLine(-1); return; }
                int max = 1;
                var d1 = A - B;
                var d2 = A - C;
                for (int i = 0; i < 30; ++i)
                {
                    var n = 1L << i;
                    if (d1 % n == 0 && d2 % n == 0)
                    {
                        max = i;
                    }
                }
                Console.WriteLine(max);
            }
            public static void B()
            {
                var N = Read.Int();
                var M = Read.Int();
                var AB = Read.TupleInt(M);
                int[] count = new int[N + 1];
                foreach(var ab in AB)
                {
                    count[ab.Item1]++;
                    count[ab.Item2]++;
                }
                Console.WriteLine(count.Count(x => x % 2 == 1) == 0 ? "YES" : "NO");
            }
            public static void C()
            {
                var H = Read.Int();
                var W = Read.Int();
                var K = Read.Int();
                var A = new bool[H + 2, W + 2];
                int Sh = -1, Sw = -1;
                for (int h = 0; h < H; ++h)
                {
                    var str = Read.Str();
                    for (int w = 0; w < W; ++w)
                    {
                        switch (str[w])
                        {
                            case '.': A[h + 1, w + 1] = true; break;
                            case 'S': A[h + 1, w + 1] = true; Sh = h + 1; Sw = w + 1; break;
                        }
                    }
                }
                var dist = new int[H + 2, W + 2];
                for (int h = 0; h < H + 2; ++h)
                {
                    for (int w = 0; w < W + 2; ++w)
                    {
                        dist[h, w] = -1;
                    }
                }
                var dx = new int[] { 0, 1, 0, -1 };
                var dy = new int[] { 1, 0, -1, 0 };
                Queue<Tuple<int, int>> queue = new Queue<Tuple<int, int>>();
                queue.Enqueue(new Tuple<int, int>(Sh, Sw));
                dist[Sh, Sw] = 0;
                while (queue.Count > 0)
                {
                    var t = queue.Dequeue();
                    if (dist[t.Item1, t.Item2] >= K) { continue; }
                    for(int i = 0; i < 4; ++i)
                    {
                        var x = t.Item1 + dx[i];
                        var y = t.Item2 + dy[i];
                        if(A[x,y] && dist[x, y] < 0)
                        {
                            dist[x, y] = dist[t.Item1, t.Item2] + 1;
                            queue.Enqueue(new Tuple<int, int>(x, y));
                        }
                    }
                }
                var min = 100000000;
                for (int h = 0; h < H + 2; ++h)
                {
                    for (int w = 0; w < W + 2; ++w)
                    {
                        if(dist[h, w] >= 0)
                        {
                            var d = Math.Min(h - 1, Math.Min(H - h, Math.Min(w - 1, W - w)));
                            min = Math.Min(min, d);
                        }
                    }
                }
                Console.WriteLine(1 + (min + K - 1) / K);
            }
            public static void D()
            {
                var N = Read.Int();
                var Adj = Read.AdjacencyList(N, N - 1);
                var dist = Graph.CalcDistance_OnTree(Adj, N, 1);
                var order = Enumerable.Range(1, N).OrderBy(i => -dist[i]).ToArray();
                var delete = new bool[N + 1];
                foreach(var v in order)
                {
                    if (delete[v]) { continue; }
                    delete[v] = true;
                    bool ok = false;
                    foreach(var w in Adj[v])
                    {
                        if (!delete[w])
                        {
                            ok = true;
                            delete[w] = true;
                            break;
                        }
                    }
                    if (!ok)
                    {
                        Console.WriteLine("First"); return;
                    }
                }
                Console.WriteLine("Second");
            }
        }

        class Graph
        {
            public static int[] CalcDistance_OnTree(Dictionary<int, HashSet<int>> adj, int N, int start)
            {
                var dist = Enumerable.Range(0, N + 1).Select(i => -1).ToArray();
                dist[start] = 0;
                Queue<int> queue = new Queue<int>();
                queue.Enqueue(start);
                while (queue.Count > 0)
                {
                    var v = queue.Dequeue();
                    foreach (var w in adj[v])
                    {
                        if (dist[w] < 0)
                        {
                            dist[w] = dist[v] + 1;
                            queue.Enqueue(w);
                        }
                    }
                }
                return dist;
            }
        }

        static class Read
        {
            static Queue<string> queue = new Queue<string>();
            static void Enqueue() { var ss = Console.ReadLine().Split(' '); foreach (var s in ss) { queue.Enqueue(s); } }
            public static int Int() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt32(queue.Dequeue()); }
            public static long Long() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt64(queue.Dequeue()); }
            public static string Str() { if (queue.Count == 0) { Enqueue(); } return queue.Dequeue(); }
            public static int[] IntN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray(); }
            public static long[] LongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray(); }
            public static string[] StrN() { return Console.ReadLine().Split(' '); }
            public static Tuple<int, int>[] TupleInt(int n) { List<Tuple<int, int>> list = new List<Tuple<int, int>>(); for (int i = 0; i < n; ++i) { var ab = Read.IntN(); list.Add(new Tuple<int, int>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<long, long>[] TupleLong(int n) { List<Tuple<long, long>> list = new List<Tuple<long, long>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<long, long>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<string, string>[] TupleStr(int n) { List<Tuple<string, string>> list = new List<Tuple<string, string>>(); for (int i = 0; i < n; ++i) { var ab = Read.StrN(); list.Add(new Tuple<string, string>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<double, double>[] TupleDouble(int n) { List<Tuple<double, double>> list = new List<Tuple<double, double>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<double, double>(ab[0], ab[1])); } return list.ToArray(); }
            public static long[,] LongMatrix(int r, int c)
            {
                var mat = new long[r, c];
                for (int i = 0; i < r; ++i)
                {
                    var x = Read.LongN();
                    for (int j = 0; j < c; ++j)
                    {
                        mat[i, j] = x[j];
                    }
                }
                return mat;
            }
            public static Dictionary<int, HashSet<int>> AdjacencyList(int N, int M)
            {
                Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new HashSet<int>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1]);
                    dict[ab[1]].Add(ab[0]);
                }
                return dict;
            }
            public static Dictionary<int, Dictionary<int, long>> AdjacencyListWithWeight(int N, int M)
            {
                Dictionary<int, Dictionary<int, long>> dict = new Dictionary<int, Dictionary<int, long>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new Dictionary<int, long>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1], ab[2]);
                    dict[ab[1]].Add(ab[0], ab[2]);
                }
                return dict;
            }
        }
    }
}