Under construction

Still being built. Things may change

Sunny Graph

Time limit3sMemory limit512 MB

Summary
Given a graph with an odd number of vertices, decide whether vertex 1 lies on a cycle of three or more vertices while all other vertices pair up into disjoint edges.
Level

Medium7 of 10

Topics
Graph, Implementation
Solved
No attempts yet

Problem

The Sun is a great heavenly body, and many religions worship it. Bob loves the Sun and loves any object that is similar to the Sun. He noticed that he can find the shape of the Sun in certain graphs, and he calls such graphs "Sunny".

A graph G=(V,E)G=(V,E) with a vertex v∈Vv \in V is called "Sunny" when there exists a subgraph G′=(V,E′),E′⊆EG'=(V,E'), E' \subseteq E that has the following two properties. The set of vertices must be the same as VV.

  1. The connected component containing vv is a cycle that consists of three or more vertices.
  2. Every other component has exactly two vertices.

The following picture is an example of a subgraph G′=(V,E′)G'=(V,E') that has the above property.

Given a simple graph G=(V,E)G=(V,E), write a program that decides whether the given graph with vertex 11 is "Sunny".

Input

The first line contains two integers NN (odd, 1≤N≤2001 \leq N \leq 200) and MM (0≤M≤20,0000 \leq M \leq 20,000), separated by a single space. NN is the number of vertices and MM is the number of edges.

The following MM lines describe the edges. Each line contains two integers viv_i and uiu_i (1≤ui,vi≤N1 \leq u_i, v_i \leq N), which means that the edge connects vertices uiu_i and viv_i. uiu_i and viv_i are different, and every pair (ui,vi)(u_i, v_i) is different.

Output

Print a line containing "Yes" when the graph is "Sunny". Otherwise, print "No".

Examples2

  1. Example 1

    Input
    5 5
    1 2
    2 3
    3 4
    4 5
    1 3
    
    Expected output
    Yes
    
  2. Example 2

    Input
    5 5
    1 2
    2 3
    3 4
    4 5
    1 4
    
    Expected output
    No