Problem:
Score : 800 points

Problem Statement

You are given a simple connected undirected graph consisting of N vertices and M edges.
The vertices are numbered 1 to N, and the edges are numbered 1 to M.

Edge i connects Vertex a_i and b_i bidirectionally.

Determine if three circuits (see Notes) can be formed using each of the edges exactly once.

Notes

A circuit is a cycle allowing repetitions of vertices but not edges.

Constraints

All values in input are integers.

1 \leq N,M \leq 10^{5}

1 \leq a_i, b_i \leq N

The given graph is simple and connected.

Input

Input is given from Standard Input in the following format:

N M
a_1 b_1
:
a_M b_M

Output

If three circuits can be formed using each of the edges exactly once, print Yes; if they cannot, print No.

Sample Input 1

7 9
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7

Sample Output 1

Yes

Three circuits can be formed using each of the edges exactly once, as follows:

Sample Input 2

3 3
1 2
2 3
3 1

Sample Output 2

No

Three circuits are needed.

Sample Input 3

18 27
17 7
12 15
18 17
13 18
13 6
5 7
7 1
14 5
15 11
7 6
1 9
5 4
18 16
4 6
7 2
7 11
6 3
12 14
5 2
10 5
7 8
10 15
3 15
9 8
7 15
5 16
18 15

Sample Output 3

Yes

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline int read()
{
	int f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x);putchar(' ');}
inline void pr2(int x){write(x);putchar('\n');}
const int MAXN=100005;
struct edge{int x,y,next;}a[2*MAXN];int len,last[MAXN];
void ins(int x,int y){len++;a[len].x=x;a[len].y=y;a[len].next=last[x];last[x]=len;}
int du[MAXN],dep[MAXN],mn[MAXN],n,m;
bool vis[MAXN];
int fa[25][MAXN],bin[25];
void dfs(int x)
{
	vis[x]=1;mn[x]=(1<<31-1);
	for(int i=1;bin[i]<=dep[x];i++)fa[i][x]=fa[i-1][fa[i-1][x]];
	for(int k=last[x];k;k=a[k].next)
	{
		int y=a[k].y;
		if(!vis[y])
		{
			fa[0][y]=x;
			dep[y]=dep[x]+1,dfs(y);
			mn[x]=min(mn[x],mn[y]);
		}
		else mn[x]=min(mn[x],dep[y]);
	}
}
int jump(int x,int u)
{
	for(int i=20;i>=0;i--)if(bin[i]<=u)x=fa[i][x],u-=bin[i];
	return x;
}
int cal[MAXN],ln;
int vi[MAXN],tim,sum[MAXN];
int check(int x)
{
	ln=(x!=1);cal[1]=0;tim++;
	for(int k=last[x];k;k=a[k].next)
	{
		int y=a[k].y;
		if(dep[y]<dep[x])cal[1]++;
		else 
		{
			int u=jump(y,dep[y]-dep[x]-1);
			if(vi[u]!=tim)vi[u]=tim,sum[u]=0;
			sum[u]++;
		}
	}
	for(int k=last[x];k;k=a[k].next)if(dep[a[k].y]==dep[x]+1)
	{
		if(mn[a[k].y]>dep[x])cal[1]+=sum[a[k].y];
		else cal[++ln]=sum[a[k].y];
	}
	int ct=0;
	for(int i=1;i<=ln;i++)ct+=(cal[i]&1);
	if(ct&1)return false;
	return ln-ct+ct/2-1;
//	return true;
}
int main()
{
	bin[0]=1;for(int i=1;i<=20;i++)bin[i]=bin[i-1]<<1;
	n=read();m=read();
	for(int i=1;i<=m;i++)
	{
		int x=read(),y=read();
		ins(x,y);ins(y,x);
		du[x]++;du[y]++;
	}
	for(int i=1;i<=n;i++)if(du[i]&1)return puts("No"),0;
	dfs(1);
	int cnt=0;
	for(int i=1;i<=n;i++)
		cnt+=check(i);
	puts(cnt>2?"Yes":"No");
	return 0;
}