#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>
#include <queue>
#include <cassert>
#include <fstream>
#include <sstream>
#define debug1(x) cout << #x" = " << x << endl;
#define debug2(x, y) cout << #x" = " << x << " " << #y" = " << y << endl;
#define debug3(x, y, z) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << endl;
#define debug4(x, y, z, w) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << " " << #w" = " << w << endl;
using namespace std;

int N, M;
bool graph[100][100];
int deg[100];
bool visit[100];

void dfs(int now)
{
	visit[now] = true;
	for (int i = 0; i < N; ++i)
		if (graph[now][i] && !visit[i])
			dfs(i);
}

bool hasCycle;
void detectCycle(int now, int father)
{
	visit[now] = true;
	for (int i = 0; i < N; ++i)
	{
		if (graph[now][i] && visit[i] && father != i) hasCycle = true;
		if (graph[now][i] && !visit[i])
			dfs(i);
	}
}

void init()
{
	cin >> N >> M;
	memset(graph, false, sizeof(graph));
	memset(deg, 0, sizeof(deg));

	for (int i = 0; i < M; ++i)
	{
		int a, b;
		cin >> a >> b;
		a--; b--;
		if (a == b && N > 1)
		{
			cout << "NO" << endl;
			return;
		}
		if (graph[a][b] && N > 2)
		{
			cout << "NO" << endl;
			return;
		}
		graph[a][b] = graph[b][a] = true;
		deg[a]++; deg[b]++;
	}

	int degtwo = 0;
	int visits = 0;
	memset(visit, false, sizeof(visit));
	dfs(0);

	for (int i = 0; i < N; ++i)
	{
		if (deg[i] == 2) degtwo++;
		if (visit[i]) visits++;
	}

	if (visits == N && degtwo == N)
	{
		cout << "YES" << endl;
		cout << 0 << endl;
		return;
	}

	if (M >= N)
	{
		cout << "NO" << endl;
		return;
	}

	if (N == 1)
	{
		cout << "YES" << endl;
		cout << "1" << endl;
		cout << "1 1" << endl;
		return;
	}

	// N > 1
	for (int i = 0; i < N; ++i)
		if (deg[i] > 2 || graph[i][i])
		{
			cout << "NO" << endl;
			return;
		}

	for (int i = 0; i < N; ++i)
	{
		memset(visit, false, sizeof(visit));
		hasCycle = false;
		detectCycle(i, -1);
		if (hasCycle)
		{
			cout << "NO" << endl;
			return;
		}
	}

	// get the answer
	cout << "YES" << endl;
	cout << N - M << endl;
	while (M < N)
	{
		int v1 = -1;
		for (int i = 0; i < N; ++i)
			if (deg[i] < 2) { v1 = i; break; }

		int v2 = -1;
		for (int i = v1 + 1; i < N; ++i)
			if (deg[i] < 2) { v2 = i; break; }

		deg[v1]++;
		deg[v2]++;
		cout << v1 + 1 << " " << v2 + 1 << endl;
		M++;
	}
}

void york()
{
}

int main()
{
	init();
	york();

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <set>
#include <algorithm>
#include <queue>
#include <cassert>
#include <fstream>
#include <sstream>
#define debug1(x) cout << #x" = " << x << endl;
#define debug2(x, y) cout << #x" = " << x << " " << #y" = " << y << endl;
#define debug3(x, y, z) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << endl;
#define debug4(x, y, z, w) cout << #x" = " << x << " " << #y" = " << y << " " << #z" = " << z << " " << #w" = " << w << endl;
using namespace std;

int N, M;
bool graph[100][100];
int deg[100];
bool visit[100];

void dfs(int now)
{
	visit[now] = true;
	for (int i = 0; i < N; ++i)
		if (graph[now][i] && !visit[i])
			dfs(i);
}

bool hasCycle;
void detectCycle(int now, int father)
{
	visit[now] = true;
	for (int i = 0; i < N; ++i)
	{
		if (graph[now][i] && visit[i] && father != i) hasCycle = true;
		if (graph[now][i] && !visit[i])
			dfs(i);
	}
}

void init()
{
	cin >> N >> M;
	memset(graph, false, sizeof(graph));
	memset(deg, 0, sizeof(deg));

	for (int i = 0; i < M; ++i)
	{
		int a, b;
		cin >> a >> b;
		a--; b--;
		if (a == b && N > 1)
		{
			cout << "NO" << endl;
			return;
		}
		if (graph[a][b] && N > 2)
		{
			cout << "NO" << endl;
			return;
		}
		graph[a][b] = graph[b][a] = true;
		deg[a]++; deg[b]++;
	}

	int degtwo = 0;
	int visits = 0;
	memset(visit, false, sizeof(visit));
	dfs(0);

	for (int i = 0; i < N; ++i)
	{
		if (deg[i] == 2) degtwo++;
		if (visit[i]) visits++;
	}

	if (visits == N && degtwo == N)
	{
		cout << "YES" << endl;
		cout << 0 << endl;
		return;
	}

	if (M >= N)
	{
		cout << "NO" << endl;
		return;
	}

	if (N == 1)
	{
		cout << "YES" << endl;
		cout << "1" << endl;
		cout << "1 1" << endl;
		return;
	}

	// N > 1
	for (int i = 0; i < N; ++i)
		if (deg[i] > 2 || graph[i][i])
		{
			cout << "NO" << endl;
			return;
		}

	for (int i = 0; i < N; ++i)
	{
		memset(visit, false, sizeof(visit));
		hasCycle = false;
		detectCycle(i, -1);
		if (hasCycle)
		{
			cout << "NO" << endl;
			return;
		}
	}

	// get the answer
	cout << "YES" << endl;
	cout << N - M << endl;
	if (N == 2)
	{
		for (int i = 0; i < N - M; ++i)
			cout << "1 2" << endl;
		return;
	}
	while (M < N)
	{
		int v1 = -1;
		for (int i = 0; i < N; ++i)
			if (deg[i] < 2) { v1 = i; break; }

		int v2 = -1;
		for (int i = v1 + 1; i < N; ++i)
			if (deg[i] < 2 && (!graph[v1][i] || M == N - 1)) { v2 = i; break; }

		deg[v1]++;
		deg[v2]++;
		graph[v1][v2] = graph[v2][v1] = true;
		cout << v1 + 1 << " " << v2 + 1 << endl;
		M++;

		for (int k = 0; k < N; ++k)
			for (int i = 0; i < N; ++i)
				for (int j = 0; j < N; ++j)
					graph[i][j] = graph[i][j] || (graph[i][k] && graph[k][j]);
	}
}

void york()
{
}

int main()
{
	init();
	york();

	return 0;
}


                            /* به نام خدا */
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<limits>
#include <list>
#include <stack>
#include<vector>
#include<string>
#include<sstream>
#include<iostream>
#include<algorithm>
#include <cassert>
using namespace std;
# define MEM(arrdoone,w)   memset(arrdoone,w,sizeof arrdoone)
# define ULL unsigned long long
# define FOR(i,a,b) for(int i = a ; i < b ; i++)
vector<int>gr[100];
int mark[100];
void dfs(int a){
  mark[ a ]=1;
  FOR(i , 0 , gr[ a ].size())
      if(mark[ gr[a][ i ] ]==-1)
          dfs( gr[a][ i ] );
}
bool diffcom(int a , int b){
    MEM(mark,-1);
     dfs(a);
//   cout << a << " "<<b<<" "<<mark[ b ]<< endl;
     if(mark[b]==-1)
         return true;
     return false;
}
int main(){
    int n,m,a,b,deg[100];
    cin >> n>>m;
    MEM(deg,0);
    FOR(i , 0 ,m){
        cin >> a >> b;
        a--;
        b--;
        gr[a].push_back(b);
        gr[b].push_back(a);
        deg[a]++;
        deg[b]++;
    }
    int no=0;
    if(m > n)
        no=1;
    FOR(i , 0 , n)
        if(deg[i] > 2 )
            no=1;
    dfs(0);
    int com=1;
    FOR(i , 0 ,n)
        if(mark[i]==0)
            com=0;
    MEM(mark,0);
    int y = 1;
    FOR(i , 0 ,n)
        if(deg[i]!=2)
            y=0;
   if(no==0 && com==1 && y && n==m)
        cout <<"YES"<<endl<<0<<endl;
    else
        if(no==1)
            cout << "NO" <<endl;
        else
        {
            cout << n-m<<endl<<"YES"<<endl;
            FOR(i , 0 , n)
                if(deg[i]==1)
                for(int j=0;j<n && j!=i ;j++)
                    if(deg[j]==1)
                        if(diffcom(i,j))
                            {deg[i]++;deg[j]++;cout << min(i , j)+ 1<< " "<< max(i , j)+ 1 << endl; gr[i].push_back(j);gr[j].push_back(i);break;}
             FOR(i , 0 , n)
                if(deg[i]==1)
                   for(int j=0;j<n && j!=i ;j++)
                       if(deg[j]==1)
                           cout << min(i,j) + 1 << " "<<max(i,j) + 1<< endl;

        }

}
/*
4 5
1 2
2 3
3 4
4 1
2 4

9 6
6 7
6 2
3 5
3 4
9 1
8 1
*/


                            /* به نام خدا */
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<limits>
#include <list>
#include <stack>
#include<vector>
#include<string>
#include<sstream>
#include<iostream>
#include<algorithm>
#include <cassert>
using namespace std;
# define MEM(arrdoone,w)   memset(arrdoone,w,sizeof arrdoone)
# define ULL unsigned long long
# define FOR(i,a,b) for(int i = a ; i < b ; i++)
vector<int>gr[100];
int mark[100];
void dfs(int a){
  mark[ a ]=1;
  FOR(i , 0 , gr[ a ].size())
      if(mark[ gr[a][ i ] ]==-1)
          dfs( gr[a][ i ] );
}
bool diffcom(int a , int b){
    MEM(mark,-1);
     dfs(a);
//   cout << a << " "<<b<<" "<<mark[ b ]<< endl;
     if(mark[b]==-1)
         return true;
     return false;
}
int main(){
    int n,m,a,b,deg[100];
    cin >> n>>m;
    MEM(deg,0);
    FOR(i , 0 ,m){
        cin >> a >> b;
        a--;
        b--;
        gr[a].push_back(b);
        gr[b].push_back(a);
        deg[a]++;
        deg[b]++;
    }
    int no=0;
    if(m > n)
        no=1;
    FOR(i , 0 , n)
        if(deg[i] > 2 )
            no=1;
    dfs(0);
    int com=1;
    FOR(i , 0 ,n)
        if(mark[i]==0)
            com=0;
    MEM(mark,0);
    int y = 1;
    FOR(i , 0 ,n)
        if(deg[i]!=2)
            y=0;
   if(no==0 && com==1 && y && n==m)
        cout <<"YES"<<endl<<0<<endl;
    else
        if(no==1)
            cout << "NO" <<endl;
        else
        {
            cout <<"YES"<<endl<<n-m<<endl;
            FOR(i , 0 , n)
                if(deg[i]==1)
                for(int j=0;j<n && j!=i ;j++)
                    if(deg[j]==1)
                        if(diffcom(i,j))
                            {deg[i]++;deg[j]++;cout << min(i , j)+ 1<< " "<< max(i , j)+ 1 << endl; gr[i].push_back(j);gr[j].push_back(i);break;}
             FOR(i , 0 , n)
                if(deg[i]==1)
                   for(int j=0;j<n && j!=i ;j++)
                       if(deg[j]==1)
                           cout << min(i,j) + 1 << " "<<max(i,j) + 1<< endl;

        }

}
/*
4 5
1 2
2 3
3 4
4 1
2 4

9 6
6 7
6 2
3 5
3 4
9 1
8 1
*/


                            /* به نام خدا */

#include<map>
#include<vector>
#include<iostream>

using namespace std;
# define MEM(arrdoone,w)   memset(arrdoone,w,sizeof arrdoone)
# define FOR(i,a,b) for(int i = a ; i < b ; i++)
vector<int>gr[100];
int mark[100],cycle = 0, par[100];

void dfs(int x){
    mark[x]=1;
    for(int i=0;i<gr[x].size();i++){
        if(mark[ gr[x][i] ] == -1){
            par[ gr[x][i] ]=x;
            dfs( gr[x][i] );
        }
        else{if(gr[x][i]!=par[x])
            cycle=1;
        }
    }
}
bool diffcom(int a , int b){
    MEM(mark,-1);
     dfs(a);
     if(mark[b]==-1)
         return true;
     return false;
}
int main(){
    MEM(par,-1);
    int n,m,a,b,deg[100];
    cin >> n>>m;
    MEM(deg,0);
    FOR(i , 0 ,m){
        cin >> a >> b;
        a--;
        b--;
        gr[a].push_back(b);
        gr[b].push_back(a);
        deg[a]++;
        deg[b]++;
    }
    int no=0;
    if(m > n)
        no=1;
    FOR(i , 0 , n)
        if(deg[i] > 2 )
            no=1;
    MEM(mark,-1);
    dfs(0);
    int com=1;
    FOR(i , 0 ,n)
        if(mark[i]==-1)
            com=0;
//  cout << com <<endl;
    MEM(mark,-1);
    int y = 1;
    FOR(i , 0 ,n)
        if(deg[i]!=2)
            y=0;
    if(no==0 && com==1 && y && n==m)
        cout <<"YES"<<endl<<0<<endl;
    else
        if(no==1 || cycle)
            cout << "NO" <<endl;
        else
        {
            cout <<"YES"<<endl<<n-m<<endl;
            FOR(i , 0 , n)
                if(deg[i]<=1)
                for(int j=0;j<n && j!=i ;j++)
                    if(deg[j]<=1)
                        if(diffcom(i,j))
                            {deg[i]++;deg[j]++;cout << min(i , j)+ 1<< " "<< max(i , j)+ 1 << endl; gr[i].push_back(j);gr[j].push_back(i);break;}
           FOR(i , 0 , n)
                if(deg[i]<=1)
                   for(int j=0;j<n && j!=i ;j++)
                       if(deg[j]<=1){
                           cout << min(i,j) + 1 <<" "<<max(i,j) + 1<< endl;
                           deg[ i ]++;deg[j]++;
                       }
           FOR(i , 0 , n)
                if(deg[i]<=1)
                    cout << i + 1 <<" "<<i + 1<< endl;

        }

}
/*
4 5
1 2
2 3
3 4
4 1
2 4

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

3 3
1 2
1 3
2 3

3 0

5 4
1 2
2 3
3 4
4 1

6 6
1 2
2 3
3 1
4 5
5 6
4 6
*/


                            /* به نام خدا */

#include<map>
#include<vector>
#include<iostream>

using namespace std;
# define MEM(arrdoone,w)   memset(arrdoone,w,sizeof arrdoone)
# define FOR(i,a,b) for(int i = a ; i < b ; i++)
vector<int>gr[100];
int mark[100];

void dfs(int a){
  mark[ a ]=1;
  FOR(i , 0 , gr[ a ].size())
      if(mark[ gr[a][ i ] ]==-1)
          dfs( gr[a][ i ] );
}
bool diffcom(int a , int b){
    MEM(mark,-1);
     dfs(a);
     if(mark[b]==-1)
         return true;
     return false;
}
int main(){
    int n,m,a,b,deg[100];
    cin >> n>>m;
    MEM(deg,0);
    FOR(i , 0 ,m){
        cin >> a >> b;
        a--;
        b--;
        gr[a].push_back(b);
        gr[b].push_back(a);
        deg[a]++;
        deg[b]++;
    }
    int no=0;
    if(m > n)
        no=1;
    FOR(i , 0 , n)
        if(deg[i] > 2 )
            no=1;
    dfs(0);
    int com=1;
    FOR(i , 0 ,n)
        if(mark[i]==0)
            com=0;
    MEM(mark,0);
    int y = 1;
    FOR(i , 0 ,n)
        if(deg[i]!=2)
            y=0;
    if(no==0 && com==1 && y && n==m)
        cout <<"YES"<<endl<<0<<endl;
    else
        if(no==1)
            cout << "NO" <<endl;
        else
        {
            cout <<"YES"<<endl<<n-m<<endl;
            FOR(i , 0 , n)
                if(deg[i]<=1)
                for(int j=0;j<n && j!=i ;j++)
                    if(deg[j]<=1)
                        if(diffcom(i,j))
                            {deg[i]++;deg[j]++;cout << min(i , j)+ 1<< " "<< max(i , j)+ 1 << endl; gr[i].push_back(j);gr[j].push_back(i);break;}
           // cout << deg[0];
            FOR(i , 0 , n)
                if(deg[i]<=1)
                   for(int j=0;j<n && j!=i ;j++)
                       if(deg[j]<=1){
                           cout << min(i,j) + 1 <<" "<<max(i,j) + 1<< endl;
                           deg[ i ]++;deg[j]++;
                       }
           FOR(i , 0 , n)
                if(deg[i]<=1)
                    cout << i + 1 <<" "<<i + 1<< endl;

        }

}
/*
4 5
1 2
2 3
3 4
4 1
2 4

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

3 3
1 2
1 3
2 3

3 0
*/


                            /* به نام خدا */

#include<map>
#include<vector>
#include<iostream>

using namespace std;
# define MEM(arrdoone,w)   memset(arrdoone,w,sizeof arrdoone)
# define FOR(i,a,b) for(int i = a ; i < b ; i++)
vector<int>gr[100];
int mark[100],cycle = 0, par[100];

void dfs(int x){
    mark[x]=1;
    for(int i=0;i<gr[x].size();i++){
        if(mark[ gr[x][i] ] == -1){
            par[ gr[x][i] ]=x;
            dfs( gr[x][i] );
        }
        else{if(gr[x][i]!=par[x])
            cycle=1;
        }
    }
}
bool diffcom(int a , int b){
    MEM(mark,-1);
     dfs(a);
     if(mark[b]==-1)
         return true;
     return false;
}
int main(){
    MEM(par,-1);
    int n,m,a,b,deg[100];
    cin >> n>>m;
    MEM(deg,0);
    FOR(i , 0 ,m){
        cin >> a >> b;
        a--;
        b--;
        gr[a].push_back(b);
        gr[b].push_back(a);
        deg[a]++;
        deg[b]++;
        if(a==b)
            cycle = 1;
    }

    int no=0;
    if(m > n)
        no=1;
    FOR(i , 0 , n)
        if(deg[i] > 2 )
            no=1;
    MEM(mark,-1);
    dfs(0);
    int com=1;
    FOR(i , 0 ,n)
        if(mark[i]==-1)
            com=0;
    MEM(mark,-1);
    int y = 1;
    FOR(i , 0 ,n)
        if(deg[i]!=2)
            y=0;
    //cout << cycle<<endl;
    if(no==0 && com==1 && y && n==m)
        cout <<"YES"<<endl<<0<<endl;
    else
        if(no==1 || cycle)
            cout << "NO" <<endl;
        else
        {
            cout <<"YES"<<endl<<n-m<<endl;
            FOR(i , 0 , n)
                if(deg[i]<=1)
                for(int j=0;j<n && j!=i ;j++)
                    if(deg[j]<=1)
                        if(diffcom(i,j))
                            {deg[i]++;deg[j]++;cout << min(i , j)+ 1<< " "<< max(i , j)+ 1 << endl; gr[i].push_back(j);gr[j].push_back(i);break;}
           FOR(i , 0 , n)
                if(deg[i]<=1)
                   for(int j=0;j<n && j!=i ;j++)
                       if(deg[j]<=1){
                           cout << min(i,j) + 1 <<" "<<max(i,j) + 1<< endl;
                           deg[ i ]++;deg[j]++;
                       }
           FOR(i , 0 , n)
                if(deg[i]<=1)
                    cout << i + 1 <<" "<<i + 1<< endl;

        }

}
/*
4 5
1 2
2 3
3 4
4 1
2 4

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

3 3
1 2
1 3
2 3

3 0

5 4
1 2
2 3
3 4
4 1

1 0

3 2
1 2
3 3

*/


                            /* به نام خدا */

#include<map>
#include<vector>
#include<iostream>

using namespace std;
# define MEM(arrdoone,w)   memset(arrdoone,w,sizeof arrdoone)
# define FOR(i,a,b) for(int i = a ; i < b ; i++)
vector<int>gr[100];
int mark[100],cycle = 0, par[100];

void dfs(int x){
    mark[x]=1;
    for(int i=0;i<gr[x].size();i++){
        if(mark[ gr[x][i] ] == -1){
            par[ gr[x][i] ]=x;
            dfs( gr[x][i] );
        }
        else{if(gr[x][i]!=par[x])
            cycle=1;
        }
    }
}
bool diffcom(int a , int b){
    MEM(mark,-1);
     dfs(a);
     if(mark[b]==-1)
         return true;
     return false;
}
int main(){
    MEM(par,-1);
    int n,m,a,b,deg[100];
    cin >> n>>m;
    MEM(deg,0);
    FOR(i , 0 ,m){
        cin >> a >> b;
        a--;
        b--;
        gr[a].push_back(b);
        gr[b].push_back(a);
        deg[a]++;
        deg[b]++;
    }
    int no=0;
    if(m > n)
        no=1;
    FOR(i , 0 , n)
        if(deg[i] > 2 )
            no=1;
    MEM(mark,-1);
    dfs(0);
    int com=1;
    FOR(i , 0 ,n)
        if(mark[i]==0)
            com=0;
    MEM(mark,-1);
    int y = 1;
    FOR(i , 0 ,n)
        if(deg[i]!=2)
            y=0;
    if(no==0 && com==1 && y && n==m)
        cout <<"YES"<<endl<<0<<endl;
    else
        if(no==1 || cycle)
            cout << "NO" <<endl;
        else
        {
            cout <<"YES"<<endl<<n-m<<endl;
            FOR(i , 0 , n)
                if(deg[i]<=1)
                for(int j=0;j<n && j!=i ;j++)
                    if(deg[j]<=1)
                        if(diffcom(i,j))
                            {deg[i]++;deg[j]++;cout << min(i , j)+ 1<< " "<< max(i , j)+ 1 << endl; gr[i].push_back(j);gr[j].push_back(i);break;}
           FOR(i , 0 , n)
                if(deg[i]<=1)
                   for(int j=0;j<n && j!=i ;j++)
                       if(deg[j]<=1){
                           cout << min(i,j) + 1 <<" "<<max(i,j) + 1<< endl;
                           deg[ i ]++;deg[j]++;
                       }
           FOR(i , 0 , n)
                if(deg[i]<=1)
                    cout << i + 1 <<" "<<i + 1<< endl;

        }

}
/*
4 5
1 2
2 3
3 4
4 1
2 4

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

3 3
1 2
1 3
2 3

3 0

5 4
1 2
2 3
3 4
4 1
*/


#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
typedef long long LL;
int n,m;
vector<vector<int>> g(55);
int st[55],p[55];
bool used[55];
int kk=0;
void dfs(int v){
    used[v]=1;
    p[v]=kk;
    for (int i=0; i<g[v].size(); i++)
        if (!used[g[v][i]])
            dfs(g[v][i]);
}
int main(){
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin>>n>>m;
    for (int i=0; i<m; i++){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        st[a]++;
        st[b]++;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for (int i=0; i<n; i++)
        if (st[i]>2){
            cout<<"NO"<<endl;
            return 0;
        }
    for (int i=0; i<n; i++)
        if (!used[i]){
            dfs(i);
            kk++;
        }
    vector<pair<int,int>> c;
    for (int k=0; k<n+1; k++)
        for (int i=0; i<n; i++)
            if (st[i]<2){
                for (int j=i+1; j<n; j++)
                    if (p[i]!=p[j] && st[j]<2){
                        st[i]++;
                        st[j]++;
                        int w=p[j];
                        for (int q=0; q<n; q++)
                            if (p[q]==w)
                                p[q]=p[i];
                        kk--;
                        pair<int,int> x;
                        x.first=i;
                        x.second=j;
                        c.push_back(x);
                        break;
                    }
                    break;
            }
    for (int k=0; k<n+1; k++)
        for (int i=0; i<n; i++)
            if (st[i]<2){
                for (int j=i+1; j<n; j++)
                    if (st[j]<2){
                        st[i]++;
                        st[j]++;
                        pair<int,int> x;
                        x.first=i;
                        x.second=j;
                        c.push_back(x);
                        break;
                    }
                    break;
            }
    for (int i=0; i<n; i++)
        if (st[i]==0){
            st[i]=2;
            pair<int,int> x;
            x.first=i;
            x.second=i;
            c.push_back(x);
        }
    for (int i=0; i<n; i++)
        if (st[i]<2 || kk>1){
            cout<<"NO"<<endl;
            return 0;
        }
    cout<<"YES"<<endl;
    cout<<c.size()<<endl;
    for (int i=0; i<c.size(); i++)
        cout<<c[i].first+1<<" "<<c[i].second+1<<endl;

    return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
typedef long long LL;
int n,m;
vector<vector<int>> g(55);
int st[55],p[55];
bool used[55];
int k=0;
void dfs(int v){
    used[v]=1;
    p[v]=k;
    for (int i=0; i<g[v].size(); i++)
        if (!used[g[v][i]])
            dfs(g[v][i]);
}
int main(){
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin>>n>>m;
    for (int i=0; i<m; i++){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        st[a]++;
        st[b]++;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for (int i=0; i<n; i++)
        if (st[i]>2){
            cout<<"NO"<<endl;
            return 0;
        }
    for (int i=0; i<n; i++)
        if (!used[i]){
            dfs(i);
            k++;
        }
    vector<pair<int,int>> c;
    for (int k=0; k<n+1; k++)
        for (int i=0; i<n; i++)
            if (st[i]<2){
                for (int j=i+1; j<n; j++)
                    if (p[i]!=p[j] && st[j]<2){
                        st[i]++;
                        st[j]++;
                        int w=p[j];
                        for (int q=0; q<n; q++)
                            if (p[q]==w)
                                p[q]=p[i];
                        pair<int,int> x;
                        x.first=i;
                        x.second=j;
                        c.push_back(x);
                        break;
                    }
                    break;
            }
    for (int k=0; k<n+1; k++)
        for (int i=0; i<n; i++)
            if (st[i]<2){
                for (int j=i+1; j<n; j++)
                    if (st[j]<2){
                        st[i]++;
                        st[j]++;
                        int w=p[j];
                        for (int q=0; q<n; q++)
                            if (p[q]==w)
                                p[q]=p[i];
                        pair<int,int> x;
                        x.first=i;
                        x.second=j;
                        c.push_back(x);
                        break;
                    }
                    break;
            }
    for (int i=0; i<n; i++)
        if (st[i]<2){
            cout<<"NO"<<endl;
            return 0;
        }
    cout<<"YES"<<endl;
    cout<<c.size()<<endl;
    for (int i=0; i<c.size(); i++)
        cout<<c[i].first+1<<" "<<c[i].second+1<<endl;

    return 0;
}


#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
typedef long long LL;
int n,m;
vector<vector<int>> g(55);
int st[55],p[55];
bool used[55];
int kk=0;
void dfs(int v){
    used[v]=1;
    p[v]=kk;
    for (int i=0; i<g[v].size(); i++)
        if (!used[g[v][i]])
            dfs(g[v][i]);
}
int main(){
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    cin>>n>>m;
    for (int i=0; i<m; i++){
        int a,b;
        cin>>a>>b;
        a--;
        b--;
        st[a]++;
        st[b]++;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for (int i=0; i<n; i++)
        if (st[i]>2){
            cout<<"NO"<<endl;
            return 0;
        }
    for (int i=0; i<n; i++)
        if (!used[i]){
            dfs(i);
            kk++;
        }
    vector<pair<int,int>> c;
    for (int k=0; k<n+1; k++)
        for (int i=0; i<n; i++)
            if (st[i]<2){
                for (int j=i+1; j<n; j++)
                    if (p[i]!=p[j] && st[j]<2){
                        st[i]++;
                        st[j]++;
                        int w=p[j];
                        for (int q=0; q<n; q++)
                            if (p[q]==w)
                                p[q]=p[i];
                        kk--;
                        pair<int,int> x;
                        x.first=i;
                        x.second=j;
                        c.push_back(x);
                        break;
                    }
                    break;
            }
    for (int k=0; k<n+1; k++)
        for (int i=0; i<n; i++)
            if (st[i]<2){
                for (int j=i+1; j<n; j++)
                    if (st[j]<2){
                        st[i]++;
                        st[j]++;
                        pair<int,int> x;
                        x.first=i;
                        x.second=j;
                        c.push_back(x);
                        break;
                    }
                    break;
            }
    for (int i=0; i<n; i++)
        if (st[i]<2 || kk>1){
            cout<<"NO"<<endl;
            return 0;
        }
    cout<<"YES"<<endl;
    cout<<c.size()<<endl;
    for (int i=0; i<c.size(); i++)
        cout<<c[i].first+1<<" "<<c[i].second+1<<endl;

    return 0;
}


#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int f[52];
int cnt[52];
int du[52];
int find(int x)
{return x==f[x]?x:f[x]=find(f[x]);}
void unit(int x,int y)
{
    int tx,ty;
    tx=find(x);
    ty=find(y);
    if(tx==ty)return;
    if(cnt[tx]>cnt[ty])
    {
        f[ty]=tx;
        cnt[tx]+=cnt[ty];
    }
    else
    {
        cnt[ty]+=cnt[tx];
        f[tx]=ty;
    }
}
int main()
{
    int i,j,x,y;
    cin>>n>>m;
    for(i=0;i<=n;i++){f[i]=i;cnt[i]=1;du[i]=0;}
    if(m>n)
    {cout<<"NO"<<endl;return 0;}
    if(n==1&&m==0)
    {
        cout<<"YES"<<endl;
        cout<<1<<endl;
        cout<<1<<" "<<1<<endl;
        return 0;
    }
    if(n==1&&m==1)
    {
        scanf("%d %d",&x,&y);
        cout<<"YES"<<endl;
        cout<<0<<endl;
        return 0;
    }
    for(i=0;i<m;i++)
    {
        scanf("%d%d",&x,&y);
        x--;y--;
        du[x]++;
        du[y]++;
        if(x==y||(i<n&&find(x)==find(y))||du[x]>2||du[y]>2)
        {
            cout<<"NO"<<endl;
            return 0;
        }
        unit(x,y);
    }
    cout<<"YES"<<endl;
    cout<<n-m<<endl;
    int num=0;
    for(i=0;i<n;i++)
    {
        while(du[i]<2)
        {
            for(j=i+1;j<n;j++)
            {
                if(du[j]<2&&(num+1==n-m||find(i)!=find(j)))
                {
                    printf("%d %d\n",i+1,j+1);
                    unit(i,j);
                    du[i]++;
                    du[j]++;
                    break;
                }
            }
        }
    }
}


#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int f[52];
int cnt[52];
int du[52];
int find(int x)
{return x==f[x]?x:find(f[x]);}
void unit(int x,int y)
{
    int tx,ty;
    tx=find(x);
    ty=find(y);
    if(tx==ty)return;
    if(cnt[tx]>cnt[ty])
    {
        f[ty]=tx;
        cnt[tx]+=cnt[ty];
    }
    else
    {
        cnt[ty]+=cnt[tx];
        f[tx]=ty;
    }
}
int main()
{
    int i,j,x,y;
    cin>>n>>m;
    for(i=0;i<n;i++){f[i]=i;cnt[i]=1;du[i]=0;}
    if(m>n)
    {cout<<"NO"<<endl;return 0;}
    if(n==1&&m==0)
    {
        cout<<"YES"<<endl;
        cout<<1<<endl;
        cout<<1<<" "<<1<<endl;
        return 0;
    }
    if(n==1&&m==1)
    {
        scanf("%d %d",&x,&y);
        cout<<"YES"<<endl;
        cout<<0<<endl;
        return 0;
    }
    for(i=0;i<m;i++)
    {
        scanf("%d%d",&x,&y);
        x--;y--;
        du[x]++;
        du[y]++;
        if(x==y||(i+1<m||m<n)&&find(x)==find(y)||du[x]>2||du[y]>2)
        {
            cout<<"NO"<<endl;
            return 0;
        }
        unit(x,y);
    }
    cout<<"YES"<<endl;
    cout<<n-m<<endl;
    int num=0;
    for(i=0;i<n;i++)
    {
        while(du[i]<2)
        {
            for(j=i+1;j<n;j++)
            {
                if(du[j]<2&&(num+1==n-m||find(i)!=find(j)))
                {
                    printf("%d %d\n",i+1,j+1);
                    unit(i,j);
                    du[i]++;
                    du[j]++;
                    break;
                }
            }
        }
    }
}


#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int f[52];
int cnt[52];
int du[52];
int find(int x)
{return x==f[x]?x:f[x]=find(f[x]);}
void unit(int x,int y)
{
    int tx,ty;
    tx=find(x);
    ty=find(y);
    if(tx==ty)return;
    if(cnt[tx]>cnt[ty])
    {
        f[ty]=tx;
        cnt[tx]+=cnt[ty];
    }
    else
    {
        cnt[ty]+=cnt[tx];
        f[tx]=ty;
    }
}
int main()
{
    int i,j,x,y;
    cin>>n>>m;
    for(i=0;i<=n;i++){f[i]=i;cnt[i]=1;du[i]=0;}
    if(m>n)
    {cout<<"NO"<<endl;return 0;}
    if(n==1&&m==0)
    {
        cout<<"YES"<<endl;
        cout<<1<<endl;
        cout<<1<<" "<<1<<endl;
        return 0;
    }
    if(n==1&&m==1)
    {
        scanf("%d %d",&x,&y);
        cout<<"YES"<<endl;
        cout<<0<<endl;
        return 0;
    }
    for(i=0;i<m;i++)
    {
        scanf("%d%d",&x,&y);
        x--;y--;
        du[x]++;
        du[y]++;
        if(x==y||(i+1<n&&find(x)==find(y))||du[x]>2||du[y]>2)
        {
            cout<<"NO"<<endl;
            return 0;
        }
        unit(x,y);
    }
    cout<<"YES"<<endl;
    cout<<n-m<<endl;
    int num=0;
    for(i=0;i<n;i++)
    {
        while(du[i]<2)
        {
            for(j=i+1;j<n;j++)
            {
                if(du[j]<2&&(num+1==n-m||find(i)!=find(j)))
                {
                    printf("%d %d\n",i+1,j+1);
                    unit(i,j);
                    du[i]++;
                    du[j]++;
                    break;
                }
            }
        }
    }
}


#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int f[100];
int cnt[100];
int du[100];
int find(int x)
{return x==f[x]?x:f[x]=find(f[x]);}
void unit(int x,int y)
{
	int tx,ty;
	tx=find(x);
	ty=find(y);
	if(tx==ty)return;
	if(cnt[tx]>cnt[ty])
	{
		f[ty]=tx;
		cnt[tx]+=cnt[ty];
	}
	else
	{
		cnt[ty]+=cnt[tx];
		f[tx]=ty;
	}
}
int main()
{
	int i,j,x,y;
	cin>>n>>m;
	for(i=0;i<=n;i++){f[i]=i;cnt[i]=1;du[i]=0;}
	if(m>n)
	{cout<<"NO"<<endl;return 0;}
	if(n==1&&m==0)
	{
		cout<<"YES"<<endl;
		cout<<1<<endl;
		cout<<1<<" "<<1<<endl;
		return 0;
	}
	if(n==1&&m==1)
	{
		scanf("%d %d",&x,&y);
		cout<<"YES"<<endl;
		cout<<0<<endl;
		return 0;
	}
	for(i=0;i<m;i++)
	{
		scanf("%d%d",&x,&y);
		x--;y--;
		du[x]++;
		du[y]++;
		if(x==y||(i+1<n&&find(x)==find(y))||du[x]>2||du[y]>2)
		{
			cout<<"NO"<<endl;
			return 0;
		}
		unit(x,y);
	}
	cout<<"YES"<<endl;
	cout<<n-m<<endl;
	for(i=0;i<n;i++)
	{
		while(du[i]<2)
		{
			for(j=i+1;j<n;j++)
			{
				if(du[j]<2&&(m+1==n||find(i)!=find(j)))
				{
					printf("%d %d\n",i+1,j+1);
					unit(i,j);
					du[i]++;
					du[j]++;
					m++;
					break;
				}
			}
		}
	}
}


#include<iostream>
using namespace std;
int n,m;
int f[52];
int cnt[52];
int du[52];
int find(int x)
{return x==f[x]?x:find(f[x]);}
void unit(int x,int y)
{
    int tx,ty;
    tx=find(x);
    ty=find(y);
    if(tx==ty)return;
    if(cnt[tx]>cnt[ty])
    {
        f[ty]=tx;
        cnt[tx]+=cnt[ty];
    }
    else
    {
        cnt[ty]+=cnt[tx];
        f[tx]=ty;
    }
}
int main()
{
    int i,j,x,y;
    bool flag;
    while(cin>>n>>m)
    {
        flag=true;
        for(i=0;i<n;i++){f[i]=i;cnt[i]=1;du[i]=0;}
        if(m>n)
        {cout<<"NO"<<endl;continue;}
        if(n==1&&m==0)
        {
            cout<<"YES"<<endl;
            cout<<1<<endl;
            cout<<1<<" "<<1<<endl;
            continue;
        }
        if(n==1&&m==1)
        {
            scanf("%d %d",&x,&y);
            cout<<"YES"<<endl;
            cout<<0<<endl;
            continue;
        }
        for(i=0;i<m;i++)
        {
            scanf("%d%d",&x,&y);
            if(flag==false)continue;
            x--;y--;
            du[x]++;
            du[y]++;
            if(x==y||(i+1<m||m<n)&&find(x)==find(y)||du[x]>2||du[y]>2)
            {
                flag=false;
                unit(x,y);
            }
        }
        if(flag==false)
        {
            cout<<"NO"<<endl;
            continue;
        }
        cout<<"YES"<<endl;
        cout<<n-m<<endl;
        for(i=0;i<n-m;i++)
        {
            if(du[i]<2)
            for(j=i+1;j<n;j++)
            {
                if(du[j]<2&&find(i)!=find(j))
                {
                    printf("%d %d\n",i+1,j+1);
                    unit(i,j);
                    du[i]++;
                    du[j]++;
                    break;
                }
            }
            if(j==n)
            {flag=false;break;}
        }
        if(!flag)
        {
            cout<<"NO"<<endl;
        }
    }
}


#include<iostream>
using namespace std;
int n,m;
int f[52];
int cnt[52];
int du[52];
int find(int x)
{return x==f[x]?x:find(f[x]);}
void unit(int x,int y)
{
    int tx,ty;
    tx=find(x);
    ty=find(y);
    if(tx==ty)return;
    if(cnt[tx]>cnt[ty])
    {
        f[ty]=tx;
        cnt[tx]+=cnt[ty];
    }
    else
    {
        cnt[ty]+=cnt[tx];
        f[tx]=ty;
    }
}
int main()
{
    int i,j,x,y;
    bool flag;
    while(cin>>n>>m)
    {
        flag=true;
        for(i=0;i<n;i++){f[i]=i;cnt[i]=1;du[i]=0;}
        if(m>n)
        {cout<<"NO"<<endl;continue;}
        if(n==1&&m==0)
        {
            cout<<"YES"<<endl;
            cout<<1<<endl;
            cout<<1<<" "<<1<<endl;
            continue;
        }
        if(n==1&&m==1)
        {
            scanf("%d%d",&x,&y);
            cout<<"YES"<<endl;
            cout<<0<<endl;
            continue;
        }
        for(i=0;i<m;i++)
        {
            scanf("%d%d",&x,&y);
            x--;y--;
            du[x]++;
            du[y]++;
            if(x==y||(i+1<m||m<n)&&find(x)==find(y)||du[x]>2||du[y]>2)
            {
                cout<<"NO"<<endl;
                unit(x,y);
                flag=false;
                break;
            }
        }
        if(flag==false)continue;
        cout<<"YES"<<endl;
        cout<<n-m<<endl;
        for(i=0;i<n;i++)
        {
            if(du[i]<2)
            for(j=i+1;j<n;j++)
            {
                if(du[j]<2&&find(i)!=find(j))
                {
                    printf("%d %d\n",i+1,j+1);
                    unit(i,j);
                    du[i]++;
                    du[j]++;
                    break;
                }
            }
            if(j==n)
            {flag=false;break;}
        }
        if(!flag)
        {
            cout<<"NO"<<endl;
        }
    }
}


#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int f[52];
int cnt[52];
int du[52];
int find(int x)
{return x==f[x]?x:find(f[x]);}
void unit(int x,int y)
{
    int tx,ty;
    tx=find(x);
    ty=find(y);
    if(tx==ty)return;
    if(cnt[tx]>cnt[ty])
    {
        f[ty]=tx;
        cnt[tx]+=cnt[ty];
    }
    else
    {
        cnt[ty]+=cnt[tx];
        f[tx]=ty;
    }
}
int main()
{
    int i,j,x,y;
    bool flag;
    while(cin>>n>>m)
    {
        flag=true;
        for(i=0;i<n;i++){f[i]=i;cnt[i]=1;du[i]=0;}
        if(m>n)
        {cout<<"NO"<<endl;continue;}
        if(n==1&&m==0)
        {
            cout<<"YES"<<endl;
            cout<<1<<endl;
            cout<<1<<" "<<1<<endl;
            continue;
        }
        if(n==1&&m==1)
        {
            scanf("%d %d",&x,&y);
            cout<<"YES"<<endl;
            cout<<0<<endl;
            continue;
        }
        for(i=0;i<m;i++)
        {
            scanf("%d%d",&x,&y);
            if(flag==false)continue;
            x--;y--;
            du[x]++;
            du[y]++;
            if(x==y||(i+1<m||m<n)&&find(x)==find(y)||du[x]>2||du[y]>2)
            {
                flag=false;
                continue;
            }
            unit(x,y);
        }
        if(flag==false)
        {
            cout<<"NO"<<endl;
            continue;
        }
        cout<<"YES"<<endl;
        cout<<n-m<<endl;
        for(i=0;i<n-m;i++)
        {
            while(du[i]<2)
            {
                for(j=i+1;j<n;j++)
                {
                    if(du[j]<2&&(i+1==n-m||find(i)!=find(j)))
                    {
                        printf("%d %d\n",i+1,j+1);
                        unit(i,j);
                        du[i]++;
                        du[j]++;
                        break;
                    }
                }
            }
        }
    }
}


#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int f[52];
int cnt[52];
int du[52];
int find(int x)
{return x==f[x]?x:find(f[x]);}
void unit(int x,int y)
{
    int tx,ty;
    tx=find(x);
    ty=find(y);
    if(tx==ty)return;
    if(cnt[tx]>cnt[ty])
    {
        f[ty]=tx;
        cnt[tx]+=cnt[ty];
    }
    else
    {
        cnt[ty]+=cnt[tx];
        f[tx]=ty;
    }
}
int main()
{
    int i,j,x,y;
    bool flag;
    cin>>n>>m;
    {
        flag=true;
        for(i=0;i<n;i++){f[i]=i;cnt[i]=1;du[i]=0;}
        if(m>n)
        {cout<<"NO"<<endl;return 0;}
        if(n==1&&m==0)
        {
            cout<<"YES"<<endl;
            cout<<1<<endl;
            cout<<1<<" "<<1<<endl;
            return 0;
        }
        if(n==1&&m==1)
        {
            scanf("%d %d",&x,&y);
            cout<<"YES"<<endl;
            cout<<0<<endl;
            return 0;
        }
        for(i=0;i<m;i++)
        {
            scanf("%d%d",&x,&y);
            if(flag==false)return 0;
            x--;y--;
            du[x]++;
            du[y]++;
            if(x==y||(i+1<m||m<n)&&find(x)==find(y)||du[x]>2||du[y]>2)
            {
                flag=false;
                return 0;
            }
            unit(x,y);
        }
        if(flag==false)
        {
            cout<<"NO"<<endl;
            return 0;
        }
        cout<<"YES"<<endl;
        cout<<n-m<<endl;
        for(i=0;i<n-m;i++)
        {
            while(du[i]<2)
            {
                for(j=i+1;j<n;j++)
                {
                    if(du[j]<2&&(i+1==n-m||find(i)!=find(j)))
                    {
                        printf("%d %d\n",i+1,j+1);
                        unit(i,j);
                        du[i]++;
                        du[j]++;
                        break;
                    }
                }
            }
        }
    }
}


#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int f[52];
int cnt[52];
int du[52];
int find(int x)
{return x==f[x]?x:f[x]=find(f[x]);}
void unit(int x,int y)
{
    int tx,ty;
    tx=find(x);
    ty=find(y);
    if(tx==ty)return;
    if(cnt[tx]>cnt[ty])
    {
        f[ty]=tx;
        cnt[tx]+=cnt[ty];
    }
    else
    {
        cnt[ty]+=cnt[tx];
        f[tx]=ty;
    }
}
int main()
{
    int i,j,x,y;
    cin>>n>>m;
    for(i=0;i<n;i++){f[i]=i;cnt[i]=1;du[i]=0;}
    if(m>n)
    {cout<<"NO"<<endl;return 0;}
    if(n==1&&m==0)
    {
        cout<<"YES"<<endl;
        cout<<1<<endl;
        cout<<1<<" "<<1<<endl;
        return 0;
    }
    if(n==1&&m==1)
    {
        scanf("%d %d",&x,&y);
        cout<<"YES"<<endl;
        cout<<0<<endl;
        return 0;
    }
    for(i=0;i<m;i++)
    {
        scanf("%d%d",&x,&y);
        x--;y--;
        du[x]++;
        du[y]++;
        if(x==y||(i+1<m||m<n)&&find(x)==find(y)||du[x]>2||du[y]>2)
        {
            cout<<"NO"<<endl;
            return 0;
        }
        unit(x,y);
    }
    cout<<"YES"<<endl;
    cout<<n-m<<endl;
    int num=0;
    for(i=0;i<n;i++)
    {
        while(du[i]<2)
        {
            for(j=i+1;j<n;j++)
            {
                if(du[j]<2&&(num+1==n-m||find(i)!=find(j)))
                {
                    printf("%d %d\n",i+1,j+1);
                    unit(i,j);
                    du[i]++;
                    du[j]++;
                    break;
                }
            }
        }
    }
}


#include<iostream>
using namespace std;
int n,m;
int f[52];
int cnt[52];
int du[52];
int find(int x)
{return x==f[x]?x:find(f[x]);}
void unit(int x,int y)
{
	int tx,ty;
	tx=find(x);
	ty=find(y);
	if(tx==ty)return;
	if(cnt[tx]>cnt[ty])
	{
		f[ty]=tx;
		cnt[tx]+=cnt[ty];
	}
	else
	{
		cnt[ty]+=cnt[tx];
		f[tx]=ty;
	}
}
int main()
{
	int i,j,x,y;
	bool flag;
	while(cin>>n>>m)
	{
		flag=true;
		for(i=0;i<n;i++){f[i]=i;cnt[i]=1;du[i]=0;}
		if(m>n)
		{cout<<"NO"<<endl;continue;}
		if(n==1&&m==0)
		{
			cout<<"YES"<<endl;
			cout<<1<<endl;
			cout<<1<<" "<<1<<endl;
			continue;
		}
		if(n==1&&m==1)
		{
			cout<<"YES"<<endl;
			cout<<0<<endl;
			continue;
		}
		for(i=0;i<m;i++)
		{
			scanf("%d%d",&x,&y);
			x--;y--;
			du[x]++;
			du[y]++;
			if(x==y||(i+1<m||m<n)&&find(x)==find(y)||du[x]>2||du[y]>2)
			{
				cout<<"NO"<<endl;
				unit(x,y);
				flag=false;
				break;
			}
		}
		if(flag==false)continue;
		cout<<"YES"<<endl;
		cout<<n-m<<endl;
		for(i=0;i<n;i++)
		{
			if(du[i]<2)
			for(j=i+1;j<n;j++)
			{
				if(du[j]<2&&find(i)!=find(j))
				{
					printf("%d %d\n",i+1,j+1);
					unit(i,j);
					du[i]++;
					du[j]++;
					break;
				}
			}
			if(j==n)
			{flag=false;break;}
		}
		if(!flag)
		{
			cout<<"NO"<<endl;
		}
	}
}


#include<iostream>
using namespace std;
int n,m;
int f[52];
int cnt[52];
int du[52];
int find(int x)
{return x==f[x]?x:find(f[x]);}
void unit(int x,int y)
{
    int tx,ty;
    tx=find(x);
    ty=find(y);
    if(tx==ty)return;
    if(cnt[tx]>cnt[ty])
    {
        f[ty]=tx;
        cnt[tx]+=cnt[ty];
    }
    else
    {
        cnt[ty]+=cnt[tx];
        f[tx]=ty;
    }
}
int main()
{
    int i,j,x,y;
    bool flag;
    while(cin>>n>>m)
    {
        flag=true;
        for(i=0;i<n;i++){f[i]=i;cnt[i]=1;du[i]=0;}
        if(m>n)
        {cout<<"NO"<<endl;continue;}
        if(n==1&&m==0)
        {
            cout<<"YES"<<endl;
            cout<<1<<endl;
            cout<<1<<" "<<1<<endl;
            continue;
        }
        if(n==1&&m==1)
        {
            scanf("%d %d",&x,&y);
            cout<<"YES"<<endl;
            cout<<0<<endl;
            continue;
        }
        for(i=0;i<m;i++)
        {
            scanf("%d%d",&x,&y);
            if(flag==false)continue;
            x--;y--;
            du[x]++;
            du[y]++;
            if(x==y||(i+1<m||m<n)&&find(x)==find(y)||du[x]>2||du[y]>2)
            {
                flag=false;
                unit(x,y);
            }
        }
        if(flag==false)
        {
            cout<<"NO"<<endl;
            continue;
        }
        cout<<"YES"<<endl;
        cout<<n-m<<endl;
        for(i=0;i<n-m;i++)
        {
            while(du[i]<2)
            {
                for(j=i+1;j<n;j++)
                {
                    if(du[j]<2&&(i+1==n-m||find(i)!=find(j)))
                    {
                        printf("%d %d\n",i+1,j+1);
                        unit(i,j);
                        du[i]++;
                        du[j]++;
                        break;
                    }
                }
            }
        }
    }
}


#include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int f[52];
int cnt[52];
int du[52];
int find(int x)
{return x==f[x]?x:f[x]=find(f[x]);}
void unit(int x,int y)
{
    int tx,ty;
    tx=find(x);
    ty=find(y);
    if(tx==ty)return;
    if(cnt[tx]>cnt[ty])
    {
        f[ty]=tx;
        cnt[tx]+=cnt[ty];
    }
    else
    {
        cnt[ty]+=cnt[tx];
        f[tx]=ty;
    }
}
int main()
{
    int i,j,x,y;
    cin>>n>>m;
    for(i=0;i<=n;i++){f[i]=i;cnt[i]=1;du[i]=0;}
    if(m>n)
    {cout<<"NO"<<endl;return 0;}
    if(n==1&&m==0)
    {
        cout<<"YES"<<endl;
        cout<<1<<endl;
        cout<<1<<" "<<1<<endl;
        return 0;
    }
    if(n==1&&m==1)
    {
        scanf("%d %d",&x,&y);
        cout<<"YES"<<endl;
        cout<<0<<endl;
        return 0;
    }
    for(i=0;i<m;i++)
    {
        scanf("%d%d",&x,&y);
        x--;y--;
        du[x]++;
        du[y]++;
        if(x==y||(i+1<n&&find(x)==find(y))||du[x]>2||du[y]>2)
        {
            cout<<"NO"<<endl;
            return 0;
        }
        unit(x,y);
    }
    cout<<"YES"<<endl;
    for(i=0;i<n;i++)
    {
        while(du[i]<2)
        {
            for(j=i+1;j<n;j++)
            {
                if(du[j]<2&&(m+1==n||find(i)!=find(j)))
                {
                    printf("%d %d\n",i+1,j+1);
                    unit(i,j);
                    du[i]++;
                    du[j]++;
                    m++;
                    break;
                }
            }
        }
    }
}


#include<iostream>
using namespace std;
int n,m;
int f[52];
int cnt[52];
int du[52];
int find(int x)
{return x==f[x]?x:find(f[x]);}
void unit(int x,int y)
{
    int tx,ty;
    tx=find(x);
    ty=find(y);
    if(tx==ty)return;
    if(cnt[tx]>cnt[ty])
    {
        f[ty]=tx;
        cnt[tx]+=cnt[ty];
    }
    else
    {
        cnt[ty]+=cnt[tx];
        f[tx]=ty;
    }
}
int main()
{
    int i,j,x,y;
    bool flag;
    while(cin>>n>>m)
    {
        flag=true;
        for(i=0;i<n;i++){f[i]=i;cnt[i]=1;du[i]=0;}
        if(m>n)
        {cout<<"NO"<<endl;continue;}
        if(n==1&&m==0)
        {
            cout<<"YES"<<endl;
            cout<<1<<endl;
            cout<<1<<" "<<1<<endl;
            continue;
        }
        if(n==1&&m==1)
        {
            scanf("%d %d",&x,&y);
            cout<<"YES"<<endl;
            cout<<0<<endl;
            continue;
        }
        for(i=0;i<m;i++)
        {
            scanf("%d%d",&x,&y);
            if(flag==false)continue;
            x--;y--;
            du[x]++;
            du[y]++;
            if(x==y||(i+1<m||m<n)&&find(x)==find(y)||du[x]>2||du[y]>2)
            {
                flag=false;
                unit(x,y);
            }
        }
        if(flag==false)
        {
            cout<<"NO"<<endl;
            continue;
        }
        cout<<"YES"<<endl;
        cout<<n-m<<endl;
        for(i=0;i<n-m;i++)
        {
            if(du[i]<2)
            {
                for(j=i+1;j<n;j++)
                {
                    if(du[j]<2&&find(i)!=find(j))
                    {
                        printf("%d %d\n",i+1,j+1);
                        unit(i,j);
                        du[i]++;
                        du[j]++;
                        break;
                    }
                }
            }
        }
    }
}


#include <iostream>
#include <fstream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <complex>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <complex>
#include <stack>
#include <memory.h>
#ifdef NEV_DEBUG
#include <ctime>
#endif
using namespace std;
#pragma comment(linker,"/STACK:64000000")

const double pi = 3.1415926535897932384626433832795;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;

#define sz size()
#define mp make_pair
#define pb push_back
#define ALL(a) (a).begin(), (a).end()
#define FOR(i,a,b) for(int i=(a),_b(b); i<_b; ++i)
#define RFOR(i,a,b) for(int i=(a)-1,_b(b); i>=_b; --i)
#define CLR(a,b) memset(a,b,sizeof(a))
#define CPY(a,b) memcpy(a,b,sizeof(a))
#define sqr(a) ((a)*(a))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define MAX(a,b) ((a)>(b)?(a):(b))

char ch[1<<20];
string gs() {scanf("%s",ch); return string(ch);}
string gl() {gets(ch); return string(ch);}
template <class T>
T gcd(T a, T b) { return (!a)?b:gcd(b%a,a); }
void error(){ int yyy=0; cout << 7/yyy; }

VVI G;

int par[1<<10];
void dsuinit(int n) {
	FOR(i,0,n) par[i]=i;
}
int getp(int x){return par[x]=(par[x]==x)?x:getp(par[x]);}
void join(int x, int y) {if (rand()&1)swap(x,y); par[getp(x)]=getp(y);}

int was[64];
int dfs(int x) {
	if (was[x]) return 0;
	was[x]=1;
	int r=1;
	FOR(i,0,G[x].sz) r+=dfs(G[x][i]);
	return r;
}
int dfs2(int S,int x, int p=-1) {
	if (x==S && was[S]) return 1;
	if (was[x]) return 0;
	was[x]=1;
	FOR(i,0,G[x].sz) if (p!=G[x][i]) if (dfs2(S,G[x][i],x)) return 1;
	return 0;
}

int main() {

#ifdef NEV_DEBUG
    freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
    clock_t beg = clock();
#else
    //freopen("union.in","r",stdin);
    //freopen("union.out","w",stdout);
#endif

	int n,m;
	scanf("%d%d",&n,&m);
	G=VVI(n);
	FOR(i,0,m) {
		int a,b; scanf("%d%d",&a,&b);
		--a,--b;
		if (a==b) {
			if (n==1 && m==1) printf("YES\n0\n");
			else printf("NO\n");
			exit(0);
		}
		G[a].pb(b);
		G[b].pb(a);
	}
	int ok=1;
	if (m==n) {
		FOR(i,0,n) if (G[i].sz!=2) ok=0;
		CLR(was,0);
		if (dfs(0)!=n) ok=0;
		if (ok) printf("YES\n0\n");
		else printf("NO\n");
	} else {
		FOR(i,0,n) {
			sort(ALL(G[i]));
			if (unique(ALL(G[i]))!=G[i].end()) ok=0;
		}

		FOR(i,0,n) if (G[i].sz>2) ok=0;
		FOR(i,0,n) {
			CLR(was,0);
			if (dfs2(i,i)) ok=0;
		}
		if (!ok) printf("NO\n");
		else {
			vector<PII> r;
			dsuinit(n);
			FOR(i,0,G.sz) FOR(j,0,G[i].sz) join(i,G[i][j]);
			int ST[64]={0};
			FOR(i,0,G.sz) ST[i]=G[i].sz;
			while(m<n) {
				int found=0;
				FOR(a,0,n) if (!found)
					FOR(b,0,n) if (!found) if (a!=b || n==1) {
						if (ST[a]<2 && ST[b]<2) {
							if (getp(a)!=getp(b) || m==n-1) {
								found=1;
								r.pb(mp(a+1,b+1));
								join(a,b);
								++ST[a];
								++ST[b];
								++m;
							}
						}
					}
				if (!found) cerr << "NOOOOOOOO\n";
			}
			printf("YES\n%d\n",r.sz);
			FOR(i,0,r.sz) printf("%d %d\n",r[i].first,r[i].second);
		}
	}

#ifdef NEV_DEBUG
    fprintf(stderr,"*** Total time: %.3lf ***\n",1.0*(clock()-beg)/CLOCKS_PER_SEC);
#endif
    return 0;
}


#pragma comment(linker, "/STACK:836777216")

#include <algorithm>
#include <iostream>
#include<stdio.h>
#include<complex>
#include <string>
#include<sstream>
#include<string.h>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include<stack>
#include <set>
#include <map>
#include<ctime>
#include<memory.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<pii,int> p3i;
typedef long double ld;
typedef vector<ld> vd;

#define FOR(i,a,b) for (int i(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define SORT(a) sort((a).begin(),(a).end())

int n,m;
int a[55][55];
int c,s;
bool u[55];

void dfs(int ver){
	if(u[ver]) return;
	u[ver]=1;c++;
	REP(i,n)if(a[ver][i]) s+=a[ver][i],dfs(i);
}

bool good(){
	vi v(n);
	REP(i,n) REP(j,n) if(a[i][j]) v[i]+=a[i][j];
	REP(i,n) if(v[i]>2) return 0;

	int sum=0;
	REP(i,n)REP(j,n) sum+=a[i][j];

	if(sum==2*n){
		c=0;CL(u,0);
		dfs(0);
		return c==n;
	}else{
		CL(u,0);
		REP(i,n) if(!u[i]){
			c=0,s=0;
			dfs(i);
			if(s>=c*2) return 0;
		}
	}

	return 1;
}

int main(){
#ifdef LocalHost
    freopen("input.txt","r",stdin);
 ///   freopen("output.txt","w",stdout);
#endif

	cin>>n>>m;
	REP(i,m){
		int x,y;
		cin>>x>>y;
		x--,y--;
		a[x][y]=a[y][x]=1;
	}
	if(good()){
		puts("YES");
		cout<<n-m<<endl;
		REP(i,n) REP(j,n) if(!a[i][j]){
			a[i][j]++;a[j][i]++;
			if(!good()) a[i][j]--,a[j][i]--;
			else cout<<i+1<<' '<<j+1<<endl;
		}
	}else puts("NO");

    return 0;
}


#pragma comment(linker, "/STACK:836777216")

#include <algorithm>
#include <iostream>
#include<stdio.h>
#include<complex>
#include <string>
#include<sstream>
#include<string.h>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include<stack>
#include <set>
#include <map>
#include<ctime>
#include<memory.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<pii,int> p3i;
typedef long double ld;
typedef vector<ld> vd;

#define FOR(i,a,b) for (int i(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define SORT(a) sort((a).begin(),(a).end())

int n,m;
int a[55][55];
int c,s;
bool u[55];

void dfs(int ver){
	if(u[ver]) return;
	u[ver]=1;c++;
	REP(i,n)if(a[ver][i]) s+=a[ver][i],dfs(i);
}

bool good(){
	vi v(n);
	REP(i,n) REP(j,n) if(a[i][j]) v[i]+=a[i][j];
	REP(i,n) if(v[i]>2) return 0;

	int sum=0;
	REP(i,n)REP(j,n) sum+=a[i][j];

	if(sum==2*n){
		c=0;CL(u,0);
		dfs(0);
		return c==n;
	}else{
		CL(u,0);
		REP(i,n) if(!u[i]){
			c=0,s=0;
			dfs(i);
			if(s>=c*2) return 0;
		}
	}

	return 1;
}

int main(){
#ifdef LocalHost
    freopen("input.txt","r",stdin);
 ///   freopen("output.txt","w",stdout);
#endif

	cin>>n>>m;
	REP(i,m ){
		int x,y;
		cin>>x>>y;
		x--,y--;
		a[x][y]=a[y][x]=1;
	}
	if(good()){
		puts("YES");
		cout<<n-m<<endl;
		REP(i,n) REP(j,n) if(!a[i][j]){
			a[i][j]++;a[j][i]++;
			if(!good()) a[i][j]--,a[j][i]--;
			else cout<<i+1<<' '<<j+1<<endl;
		}
	}else puts("NO");

    return 0;
}


#pragma comment(linker, "/STACK:836777216")

#include <algorithm>
#include <iostream>
#include<stdio.h>
#include<complex>
#include <string>
#include<sstream>
#include<string.h>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include<stack>
#include <set>
#include <map>
#include<ctime>
#include<memory.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<pii,int> p3i;
typedef long double ld;
typedef vector<ld> vd;

#define FOR(i,a,b) for (int i(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define SORT(a) sort((a).begin(),(a).end())

int n,m;
int a[55][55];
int c,s;
bool u[55];

void dfs(int ver){
	if(u[ver]) return;
	u[ver]=1;c++;
	REP(i,n)if(a[ver][i]) s+=a[ver][i],dfs(i);
}

bool good(){
	vi v(n);
	REP(i,n) REP(j,n) if(a[i][j]) v[i]+=a[i][j];
	REP(i,n) if(v[i]>2) return 0;

	int sum=0;
	REP(i,n)REP(j,n) sum+=a[i][j];

	if(sum==2*n){
		c=0;CL(u,0);
		dfs(0);
		return c==n;
	}else{
		CL(u,0);
		REP(i,n) if(!u[i]){
			c=0,s=0;
			dfs(i);
			if(s>=c*2) return 0;
		}
	}

	return 1;
}

int main(){
#ifdef LocalHost
    freopen("input.txt","r",stdin);
 ///   freopen("output.txt","w",stdout);
#endif

	cin>>n>>m;
	REP(i,m ){
		int x,y;
		cin>>x>>y;
		x--,y--;
		a[x][y]++;
		a[y][x]++;
	}
	if(good()){
		puts("YES");
		cout<<n-m<<endl;
		REP(i,n) REP(j,n){
			while(1){
				a[i][j]++;a[j][i]++;
				if(!good()) {a[i][j]--,a[j][i]--;break;}
				else cout<<i+1<<' '<<j+1<<endl;
			}
		}
	}else puts("NO");

    return 0;
}


#pragma comment(linker, "/STACK:836777216")

#include <algorithm>
#include <iostream>
#include<stdio.h>
#include<complex>
#include <string>
#include<sstream>
#include<string.h>
#include <vector>
#include <bitset>
#include <cmath>
#include <queue>
#include<stack>
#include <set>
#include <map>
#include<ctime>
#include<memory.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<double,double> pdd;
typedef pair<pii,int> p3i;
typedef long double ld;
typedef vector<ld> vd;

#define FOR(i,a,b) for (int i(a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define UN(v) sort((v).begin(),(v).end()),v.erase(unique(v.begin(),v.end()),v.end())
#define CL(a,b) memset(a,b,sizeof(a))
#define pb push_back
#define SORT(a) sort((a).begin(),(a).end())

int n,m;
int a[55][55];
int c,s;
bool u[55];

void dfs(int ver){
	if(u[ver]) return;
	u[ver]=1;c++;
	REP(i,n)if(a[ver][i]) s+=a[ver][i],dfs(i);
}

bool good(){
	vi v(n);
	REP(i,n) REP(j,n) if(a[i][j]) v[i]+=a[i][j];
	REP(i,n) if(v[i]>2) return 0;

	int sum=0;
	REP(i,n)REP(j,n) sum+=a[i][j];

	if(sum==2*n){
		c=0;CL(u,0);
		dfs(0);
		return c==n;
	}else{
		CL(u,0);
		REP(i,n) if(!u[i]){
			c=0,s=0;
			dfs(i);
			if(s>=c*2) return 0;
		}
	}

	return 1;
}

int main(){
#ifdef LocalHost
    freopen("input.txt","r",stdin);
 ///   freopen("output.txt","w",stdout);
#endif

	cin>>n>>m;
	REP(i,m ){
		int x,y;
		cin>>x>>y;
		x--,y--;
		a[x][y]++;
		a[y][x]++;
	}
	if(good()){
		puts("YES");
		cout<<n-m<<endl;
		REP(i,n) REP(j,n) if(!a[i][j]){
			a[i][j]++;a[j][i]++;
			if(!good()) a[i][j]--,a[j][i]--;
			else cout<<i+1<<' '<<j+1<<endl;
		}
	}else puts("NO");

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:16777216")
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <iostream>
#include <unordered_map>
#include <stack>
#include <fstream>
#include <queue>

using namespace std;

#define pb push_back
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define eps 1e-6
typedef  long long ll;
typedef  long double ld;
typedef vector < ll > vll;
typedef vector < int > vi;
typedef pair < ll, ll > pll;
typedef int huint;
const ll Mll = 1000000000000000000;
const int Mint = 1000000000;
const ll mod = 1000000007;

pair<int, int> a[100];
vector<pair<int, int>> b;

int f[100][100];

int main()
{
    ios_base::sync_with_stdio(false);
      //   freopen("input.txt", "r", stdin);
      //   freopen("output.txt", "w", stdout);
         int n, m;
         cin >> n >> m;
         if (n == 1)
         {
           if (m == 0) cout << "YES\n0";
           else cout << "NO";
           return 0;
         }
         if (n == 2)
         {
           cout << "NO";
           return 0;
         }

         for (int i(0); i < m; i++)
         {
           int x, y;
           cin >> x >> y;
           if (x == y){ cout << "NO"; return 0; }
           if (f[x][y] == 1){ cout << "NO"; return 0; }
           f[x][y] = 1; f[y][x] = 1;
           a[x].second++;
           a[y].second++;
           if (a[x].S > 2){ cout << "NO"; return 0; }
           if (a[y].S > 2){ cout << "NO"; return 0; }
         }
         for (int l(1); l <= n; l++)
           a[l].F = l;
         sort(a, a + n + 1);

         for (int l(1); l <= n; l++)
         {
           if (a[l].S == 2) continue;
           for (int r(l + 1); r <= n; r++)
           {
             if (a[r].S == 2) continue;
             int x = a[l].F, y = a[r].F;
             int kx = a[l].S, ky = a[r].S;
             if (kx + ky == 2) continue;
             if (f[x][y] == 1) continue;
             b.pb(mp(x, y));
             a[l].S++; a[r].S++;
             f[x][y] = 1; f[y][x] = 1;
             break;
           }
         }
         for (int l(1); l <= n;l++)
         {
           if (a[l].S == 2) continue;
           for (int r(l+1); r <= n; r++)
           {
             if (a[r].S == 2) continue;
             int x = a[l].F, y = a[r].F;
             int kx = a[l].S, ky = a[r].S;
             if (f[x][y] == 1) continue;
             b.pb(mp(x, y));
             a[l].S++; a[r].S++;
             f[x][y] = 1; f[y][x] = 1;
             break;
           }
         }
         cout << "YES\n";
         cout << b.size() << endl;
         sort(b.begin(), b.end());
         for (int i(0); i < b.size(); i++)
           cout << b[i].first <<" " << b[i].second << endl;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:16777216")
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <iostream>
#include <unordered_map>
#include <stack>
#include <fstream>
#include <queue>

using namespace std;

#define pb push_back
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define eps 1e-6
typedef  long long ll;
typedef  long double ld;
typedef vector < ll > vll;
typedef vector < int > vi;
typedef pair < ll, ll > pll;
typedef int huint;
const ll Mll = 1000000000000000000;
const int Mint = 1000000000;
const ll mod = 1000000007;

pair<int, int> a[100];
vector<pair<int, int>> b;

int f[100][100];

int main()
{
    ios_base::sync_with_stdio(false);
      //    freopen("input.txt", "r", stdin);
      //    freopen("output.txt", "w", stdout);
         int n, m;
         cin >> n >> m;
         if (n == 1)
         {
           if (m == 1) cout << "YES\n0"; else
           if (m == 0) cout << "YES\n1\n1 1"; else
             cout << "NO";
           return 0;
         }
         if (n == 2)
         {
           for (int i(0); i < m; i++)
           {
             int x, y;
             cin >> x >> y;
             f[x][y] = 1;f[y][x] = 1;
             if (x == y){ cout << "NO"; return 0; }
           }
           if (f[1][2] == 2) cout << "YES\n0";
           else if (f[1][2] == 1) cout << "YES\n1\n1 2";
           else if (f[1][2] == 0) cout << "YES\n2\n1 2\n 1 2";
           else cout << "NO";
           return 0;
         }

         for (int i(0); i < m; i++)
         {
           int x, y;
           cin >> x >> y;
           if (x == y){ cout << "NO"; return 0; }
           if (f[x][y] == 1){ cout << "NO"; return 0; }
           f[x][y] = 1; f[y][x] = 1;
           a[x].second++;
           a[y].second++;
           if (a[x].S > 2){ cout << "NO"; return 0; }
           if (a[y].S > 2){ cout << "NO"; return 0; }
         }
         for (int l(1); l <= n; l++)
           a[l].F = l;
         sort(a, a + n + 1);

         for (int l(1); l <= n; l++)
         {
           if (a[l].S == 2) continue;
           for (int r(l + 1); r <= n; r++)
           {
             if (a[r].S == 2) continue;
             int x = a[l].F, y = a[r].F;
             int kx = a[l].S, ky = a[r].S;
             if (kx + ky == 2) continue;
             if (f[x][y] == 1) continue;
             b.pb(mp(x, y));
             a[l].S++; a[r].S++;
             f[x][y] = 1; f[y][x] = 1;
             break;
           }
         }
         for (int l(1); l <= n;l++)
         {
           if (a[l].S == 2) continue;
           for (int r(l+1); r <= n; r++)
           {
             if (a[r].S == 2) continue;
             int x = a[l].F, y = a[r].F;
             int kx = a[l].S, ky = a[r].S;
             if (f[x][y] == 1) continue;
             b.pb(mp(x, y));
             a[l].S++; a[r].S++;
             f[x][y] = 1; f[y][x] = 1;
             break;
           }
         }
         cout << "YES\n";
         cout << b.size() << endl;
         sort(b.begin(), b.end());
         for (int i(0); i < b.size(); i++)
           cout << b[i].first <<" " << b[i].second << endl;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:16777216")
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <iostream>
#include <unordered_map>
#include <stack>
#include <fstream>
#include <queue>

using namespace std;

#define pb push_back
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define eps 1e-6
typedef  long long ll;
typedef  long double ld;
typedef vector < ll > vll;
typedef vector < int > vi;
typedef pair < ll, ll > pll;
typedef int huint;
const ll Mll = 1000000000000000000;
const int Mint = 1000000000;
const ll mod = 1000000007;

int a[100],n,m;
vector<pair<int, int>> b;

int f[100][100];

bool check(int x, int y)
{
  for (int i(1); i <= n; i++)
  {
    if (f[x][i] == 1 && f[i][y] == 1) return true;
  }
  return false;
}
int main()
{
    ios_base::sync_with_stdio(false);
      //      freopen("input.txt", "r", stdin);
      //      freopen("output.txt", "w", stdout);
         cin >> n >> m;
         if (n == 1)
         {
           if (m == 1) cout << "YES\n0"; else
           if (m == 0) cout << "YES\n1\n1 1"; else
             cout << "NO";
           return 0;
         }
         if (n == 2)
         {
           for (int i(0); i < m; i++)
           {
             int x, y;
             cin >> x >> y;
             f[x][y]++;f[y][x]++;
             if (x == y){ cout << "NO"; return 0; }
           }
           if (f[1][2] == 2) cout << "YES\n0";
           else if (f[1][2] == 1) cout << "YES\n1\n1 2";
           else if (f[1][2] == 0) cout << "YES\n2\n1 2\n 1 2";
           else cout << "NO";
           return 0;
         }

         for (int i(0); i < m; i++)
         {
           int x, y;
           cin >> x >> y;
           if (x == y){ cout << "NO"; return 0; }
           if (f[x][y] == 1){ cout << "NO"; return 0; }
           f[x][y] += 1; f[y][x] += 1;
           a[x]++;
           a[y]++;
           if (a[x] > 2){ cout << "NO"; return 0; }
           if (a[y] > 2){ cout << "NO"; return 0; }
         }
         int l = 1, r = 2;
         while (l<=n && r <= n)
         {
           while (a[l] < 2 && r <= n)
           {
             if (a[r] == 2){ r++; continue; }
             if (a[r] + a[l] < 2)
             {
               b.pb(mp(l, r));
               a[l]++; a[r]++;
               f[l][r]++; f[r][l]++;
               continue;
             }
             if (f[l][r] == 1){ r++; continue; }
             if (check(l,r)){ r++; continue; }
             b.pb(mp(l, r));
             a[l]++; a[r]++;
             f[l][r]++; f[r][l]++;
           }
           l++, r = l + 1;

         }
         cout << "YES\n";
         cout << b.size() << endl;
         sort(b.begin(), b.end());
         for (int i(0); i < b.size(); i++)
           cout << b[i].first <<" " << b[i].second << endl;
}


#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:16777216")
#include <cmath>
#include <complex>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <iostream>
#include <unordered_map>
#include <stack>
#include <fstream>
#include <queue>

using namespace std;

#define pb push_back
#define mp(a,b) make_pair(a,b)
#define F first
#define S second
#define eps 1e-6
typedef  long long ll;
typedef  long double ld;
typedef vector < ll > vll;
typedef vector < int > vi;
typedef pair < ll, ll > pll;
typedef int huint;
const ll Mll = 1000000000000000000;
const int Mint = 1000000000;
const ll mod = 1000000007;

int a[100],n,m;
vector<pair<int, int>> b;

int f[100][100];

bool check(int x, int y)
{
  for (int i(1); i <= n; i++)
  {
    if (f[x][i] == 1 && f[i][y] == 1) return true;
  }
  return false;
}
int main()
{
    ios_base::sync_with_stdio(false);
      //      freopen("input.txt", "r", stdin);
      //      freopen("output.txt", "w", stdout);
         cin >> n >> m;
         if (n == 1)
         {
           if (m == 1) cout << "YES\n0"; else
           if (m == 0) cout << "YES\n1\n1 1"; else
             cout << "NO";
           return 0;
         }
         if (n == 2)
         {
           for (int i(0); i < m; i++)
           {
             int x, y;
             cin >> x >> y;
             f[x][y]++;f[y][x]++;
             if (x == y){ cout << "NO"; return 0; }
           }
           if (f[1][2] == 2) cout << "YES\n0";
           else if (f[1][2] == 1) cout << "YES\n1\n1 2";
           else if (f[1][2] == 0) cout << "YES\n2\n1 2\n 1 2";
           else cout << "NO";
           return 0;
         }

         for (int i(0); i < m; i++)
         {
           int x, y;
           cin >> x >> y;
           if (x == y){ cout << "NO"; return 0; }
           if (f[x][y] == 1){ cout << "NO"; return 0; }
           f[x][y] += 1; f[y][x] += 1;
           a[x]++;
           a[y]++;
           if (a[x] > 2){ cout << "NO"; return 0; }
           if (a[y] > 2){ cout << "NO"; return 0; }
         }
         int l = 1, r = 2;
         while (l<=n && r <= n)
         {
           while (a[l] < 2 && r <= n)
           {
             if (a[r] == 2){ r++; continue; }
             if (a[r] + a[l] < 2)
             {
               b.pb(mp(l, r));
               a[l]++; a[r]++;
               f[l][r]++; f[r][l]++;
               continue;
             }
             if (f[l][r] == 1){ r++; continue; }
             if (check(l,r)){ r++; continue; }
             b.pb(mp(l, r));
             a[l]++; a[r]++;
             f[l][r]++; f[r][l]++;
           }
           l++, r = l + 1;

         }  l = 1, r = 2;
         while (l <= n && r <= n)
         {
           while (a[l] < 2 && r <= n)
           {
             if (a[r] == 2){ r++; continue; }
             if (a[r] + a[l] < 2)
             {
               b.pb(mp(l, r));
               a[l]++; a[r]++;
               f[l][r]++; f[r][l]++;
               continue;
             }
             if (f[l][r] == 1){ r++; continue; }
             b.pb(mp(l, r));
             a[l]++; a[r]++;
             f[l][r]++; f[r][l]++;
           }
           l++, r = l + 1;

         }
         cout << "YES\n";
         cout << b.size() << endl;
         sort(b.begin(), b.end());
         for (int i(0); i < b.size(); i++)
           cout << b[i].first <<" " << b[i].second << endl;
}


import java.util.*;
import java.io.*;
import java.lang.*;

public final class ideone
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t-- > 0)
        {
            int x1=sc.nextInt();
            int y1=sc.nextInt();
            int x2=sc.nextInt();
            int y2=sc.nextInt();
            int m=Math.abs(x2-x1);
            int n=Math.abs(y2-y1);

        System.out.println(m*n+1);

        }

    }
}


/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public final class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc=new Scanner(System.in);
		int t=sc.nextInt();
		while(t-->0)
		{
			int x1=sc.nextInt();
			int y1=sc.nextInt();
			int x2=sc.nextInt();
			int y2=sc.nextInt();
			int m=x2-x1;
			int n=y2-y1;
			if(n==0||m==0)
			System.out.println("1");
			else
			{
				int count[][] = new int[m+1][n+1];

	         for (int i = 0; i <=m; i++)
	            count[i][0] = 1;

	        for (int j = 0; j <=n; j++)
	            count[0][j] = 1;

	        for (int i = 1; i <=m; i++) {
	            for (int j = 1; j <=n; j++)
	                count[i][j] = count[i - 1][j] + count[i][j - 1];
	        }
	    	 System.out.println(count[m][n]);
			}
		}
	}
}


import java.util.*;
import java.io.*;
import java.lang.*;

public final class ideone
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t-- > 0)
        {
            int x=sc.nextInt();
            int y=sc.nextInt();
            int x2=sc.nextInt();
            int y2=sc.nextInt();
            int m=Math.abs(x2-x)+1;
            int n=Math.abs(y2-y)+1;
            int count[][] = new int[m][n];

        // Count of paths to reach any cell in
        // first column is 1
        for (int i = 0; i < m; i++)
            count[i][0] = 1;

        // Count of paths to reach any cell in
        // first column is 1
        for (int j = 0; j < n; j++)
            count[0][j] = 1;

        // Calculate count of paths for other
        // cells in bottom-up manner using
        // the recursive solution
        for (int i = 1; i < m; i++) {
            for (int j = 1; j < n; j++)

                // By uncommenting the last part the
                // code calculatest he total possible paths
                // if the diagonal Movements are allowed
                count[i][j] = count[i - 1][j] + count[i][j - 1]; //+ count[i-1][j-1];
        }
        System.out.println(count[m-1][n-1]);

        }

    }
}


import java.util.*;
import java.io.*;
import java.lang.*;

public final class ideone
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t-- > 0)
        {
            int x1=sc.nextInt();
            int y1=sc.nextInt();
            int x2=sc.nextInt();
            int y2=sc.nextInt();
            int m=Math.abs(x2-x1)+1;
            int n=Math.abs(y2-y1)+1;
            int count[][] = new int[m+1][n+1];

        // Count of paths to reach any cell in
        // first column is 1
        for (int i = 0; i < m; i++)
            count[i][0] = 1;

        // Count of paths to reach any cell in
        // first column is 1
        for (int j = 0; j < n; j++)
            count[0][j] = 1;

        // Calculate count of paths for other
        // cells in bottom-up manner using
        // the recursive solution
        for (int i = 1; i < m; i++) {
            for (int j = 1; j < n; j++)

                // By uncommenting the last part the
                // code calculatest he total possible paths
                // if the diagonal Movements are allowed
                count[i][j] = count[i - 1][j] + count[i][j - 1]; //+ count[i-1][j-1];
        }
        System.out.println(count[m][n]);

        }

    }
}


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;

public final class ideone
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t-- > 0)
        {
            int x1=sc.nextInt();
            int y1=sc.nextInt();
            int x2=sc.nextInt();
            int y2=sc.nextInt();
            int m=Math.abs(x2-x1);
            int n=Math.abs(y2-y1);
         BigInteger ans=new BigInteger(""+m);
         BigInteger ans2=new BigInteger(""+n);
         ans=ans2.multiply(ans);
        ans=ans.add(new BigInteger("1"));
        System.out.println(ans);

        }

    }
}


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public final class ideone
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t-- > 0)
        {
            int x1=sc.nextInt();
            int y1=sc.nextInt();
            int x2=sc.nextInt();
            int y2=sc.nextInt();
            int m=Math.abs(x2-x1);
            int n=Math.abs(y2-y1);
         BigInteger ans=new BigInteger(""+m);
         BigInteger ans2=new BigInteger(""+n);
         ans=ans2.multiply(ans);

        System.out.println(ans);

        }

    }
}


import java.util.*;
import java.io.*;
import java.lang.*;

public final class ideone
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t-- > 0)
        {
            int x1=sc.nextInt();
            int y1=sc.nextInt();
            int x2=sc.nextInt();
            int y2=sc.nextInt();
            int m=Math.abs(x2-x1);
            int n=Math.abs(y2-y1);
          long ans=m*n+1;

        System.out.println(ans);

        }

    }
}


import java.util.*;
import java.io.*;
import java.lang.*;

public final class ideone
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int t=sc.nextInt();
        while(t-- > 0)
        {
            int x1=sc.nextInt();
            int y1=sc.nextInt();
            int x2=sc.nextInt();
            int y2=sc.nextInt();
            int m=Math.abs(x2-x1)+1;
            int n=Math.abs(y2-y1)+1;
            int count[][] = new int[m][n];

        // Count of paths to reach any cell in
        // first column is 1
        for (int i = 0; i < m; i++)
            count[i][0] = 1;

        // Count of paths to reach any cell in
        // first column is 1
        for (int j = 0; j < n; j++)
            count[0][j] = 1;

        // Calculate count of paths for other
        // cells in bottom-up manner using
        // the recursive solution
        for (int i = 1; i < m; i++) {
            for (int j = 1; j < n; j++)

                // By uncommenting the last part the
                // code calculatest he total possible paths
                // if the diagonal Movements are allowed
                count[i][j] = count[i - 1][j] + count[i][j - 1]; //+ count[i-1][j-1];
        }
        System.out.println(count[m-1][n-1]);

        }

    }
}


import java.util.*;
public class Celixproblem {

    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while(t-->0){
            int x1 = sc.nextInt();
            int y1 = sc.nextInt();
            int x2 = sc.nextInt();
            int y2 = sc.nextInt();
            int sum = (y2-y1)*(x2-x1)+1;
            System.out.println(sum);
        }
    }
}


import java.util.*;
public class Celixproblem {

    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while(t-->0){
            long x1 = sc.nextLong();
            long y1 = sc.nextLong();
            long x2 = sc.nextLong();
            long y2 = sc.nextLong();
            long sum = (y2-y1)*(x2-x1)+1;
            System.out.println(sum);
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
/**
 * @author Lin
 * @version 1.0
 * @date 2020/11/28 17:48
 */
public class CelexUpdate
{
	static int mod = 1000000007;
	public static void main(String[] args) throws IOException
	{
		int testNum = Reader.nextInt();
		StringBuffer stringBuffer = new StringBuffer();
		for (int rr = 0; rr < testNum; rr++)
		{
			int x = Reader.nextInt();
			int y = Reader.nextInt();
			int x1 = Reader.nextInt();
			int y1 = Reader.nextInt();
			long ans = (x1 - x) * (y1 - y) + 1;
			stringBuffer.append(ans + "\n");
		}
		System.out.println(stringBuffer.toString());

	}

	static class Reader {
		static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		static StringTokenizer tokenizer = new StringTokenizer("");
		static String nextLine() throws IOException
		{// 读取下一行字符串
			return reader.readLine();
		}
		static String next() throws IOException {// 读取下一个字符串
			while (!tokenizer.hasMoreTokens()) {
				tokenizer = new StringTokenizer(reader.readLine());
			}
			return tokenizer.nextToken();
		}

		static int nextInt() throws IOException {// 读取下一个int型数值
			return Integer.parseInt(next());
		}
		static long nextLong() throws IOException {// 读取下一个int型数值
			return Long.parseLong(next());
		}
		static double nextDouble() throws IOException {// 读取下一个double型数值
			return Double.parseDouble(next());
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
/**
 * @author Lin
 * @version 1.0
 * @date 2020/11/28 17:48
 */
public class CelexUpdate
{
	static int mod = 1000000007;
	public static void main(String[] args) throws IOException
	{
		int testNum = Reader.nextInt();
		StringBuffer stringBuffer = new StringBuffer();
		for (int rr = 0; rr < testNum; rr++)
		{
			int x = Reader.nextInt();
			int y = Reader.nextInt();
			int x1 = Reader.nextInt();
			int y1 = Reader.nextInt();
			long ans = (long)(x1 - x) * (y1 - y) + 1;
			stringBuffer.append(ans + "\n");
		}
		System.out.println(stringBuffer.toString());

	}

	static class Reader {
		static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		static StringTokenizer tokenizer = new StringTokenizer("");
		static String nextLine() throws IOException
		{// 读取下一行字符串
			return reader.readLine();
		}
		static String next() throws IOException {// 读取下一个字符串
			while (!tokenizer.hasMoreTokens()) {
				tokenizer = new StringTokenizer(reader.readLine());
			}
			return tokenizer.nextToken();
		}

		static int nextInt() throws IOException {// 读取下一个int型数值
			return Integer.parseInt(next());
		}
		static long nextLong() throws IOException {// 读取下一个int型数值
			return Long.parseLong(next());
		}
		static double nextDouble() throws IOException {// 读取下一个double型数值
			return Double.parseDouble(next());
		}
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pranay2516
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int x1 = in.nextInt(), y1 = in.nextInt(), x2 = in.nextInt(), y2 = in.nextInt();
            if (x1 == x2 || y1 == y2) {
                out.println(1);
                return;
            }
            int a = Math.abs(x2 - x1);
            int b = Math.abs(y2 - y1);
            int max = Math.max(a, b);
            int min = Math.min(a, b);
            out.println(((long) a) * b + 1);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pranay2516
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int x1 = in.nextInt(), y1 = in.nextInt(), x2 = in.nextInt(), y2 = in.nextInt();
            if (x1 == x2 || y1 == y2) {
                out.println(1);
                return;
            }
            int a = Math.abs(x2 - x1);
            int b = Math.abs(y2 - y1);
            int max = Math.max(a, b);
            int min = Math.min(a, b);
            out.println(a * b + 1);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pranay2516
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int x1 = in.nextInt(), y1 = in.nextInt(), x2 = in.nextInt(), y2 = in.nextInt();
            if (x1 == x2 || y1 == y2) {
                out.println(1);
                return;
            }
            int a = Math.abs(x2 - x1);
            int b = Math.abs(y2 - y1);
            int max = Math.max(a, b);
            int min = Math.min(a, b);
            out.println(a + b);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pranay2516
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int x1 = in.nextInt(), y1 = in.nextInt(), x2 = in.nextInt(), y2 = in.nextInt();
            if (x1 == x2 || y1 == y2) {
                out.println(1);
                return;
            }
            out.println(factorial(Math.abs(x2 - x1) + Math.abs(y2 - y1)) / (factorial(Math.abs(x2 - x1)) * factorial(Math.abs(y2 - y1))));
        }

        static long factorial(long N) {
            long result = 1;
            while (N > 0) {
                result = result * N;
                N--;
            }
            return result;
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pranay2516
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        int testCount = Integer.parseInt(in.next());
        for (int i = 1; i <= testCount; i++)
            solver.solve(i, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int x1 = in.nextInt(), y1 = in.nextInt(), x2 = in.nextInt(), y2 = in.nextInt();
            if (x1 == x2 || y1 == y2) {
                out.println(1);
                return;
            }
            int a = Math.abs(x2 - x1);
            int b = Math.abs(y2 - y1);
            int max = Math.max(a, b);
            int min = Math.min(a, b);
            //out.println((int)Math.ceil(func.C(max+min,min)));
            out.println(numb(a + 1, b + 1));
        }

        static int numb(int m, int n) {
            int path = 1;
            for (int i = n; i < (m + n - 1); i++) {
                path *= i;
                path /= (i - n + 1);
            }
            return path;
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {

            if (numChars == -1)
                throw new InputMismatchException();

            if (curChar >= numChars) {

                curChar = 0;

                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }

                if (numChars <= 0)
                    return -1;
            }

            return buf[curChar++];
        }

        public int nextInt() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

            int res = 0;

            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();

                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));

            return res * sgn;
        }

        public String next() {

            int c = read();

            while (isSpaceChar(c))
                c = read();

            StringBuilder res = new StringBuilder();

            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {

            if (filter != null)
                return filter.isSpaceChar(c);

            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}