#include <bits/stdc++.h>
using namespace std;

const int maxn = 55;
int n, m, fa[maxn], deg[maxn];

int root(int x) { return fa[x] == fa[fa[x]] ? fa[x] : fa[x] = root(fa[x]); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  bool flag = false;
  for (int i = 1; i <= n; ++i)
    fa[i] = i;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    ++deg[a], ++deg[b];
    flag = (root(a) == root(b));
    fa[fa[a]] = fa[b];
  }
  bool ok = m == n;
  for (int i = 1; ok && i <= n; ++i)
    ok = deg[i] == 2;
  for (int i = 2; ok && i <= n; ++i)
    ok = root(i) == root(1);
  if (ok) {
    cout << "YES\n0\n";
    return 0;
  }
  for (int i = 1; !flag && i <= n; ++i)
    flag = deg[i] > 2;
  if (flag || m >= n) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n" << n - m << '\n';
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; deg[i] < 2 && j <= n; ++j)
      if (deg[j] < 2 && root(i) != root(j)) {
        cout << i << ' ' << j << '\n';
        fa[fa[i]] = fa[j];
        ++deg[i], ++deg[j];
      }
  for (int i = 1; i <= n; ++i)
    if (deg[i] < 2) {
      if (n == 1)
        cout << i << ' ' << i;
      else
        cout << i << ' ';
    }
  cout << '\n';
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 55;
int n, m, fa[maxn], deg[maxn];

int root(int x) { return fa[x] == fa[fa[x]] ? fa[x] : fa[x] = root(fa[x]); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  bool flag = false;
  for (int i = 1; i <= n; ++i)
    fa[i] = i;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    ++deg[a], ++deg[b];
    flag = (root(a) == root(b));
    fa[fa[a]] = fa[b];
  }
  bool ok = m == n;
  for (int i = 1; ok && i <= n; ++i)
    ok = deg[i] == 2;
  for (int i = 2; ok && i <= n; ++i)
    ok = root(i) == root(1);
  if (ok) {
    cout << "YES\n0\n";
    return 0;
  }
  for (int i = 1; !flag && i <= n; ++i)
    flag = deg[i] > 2;
  if (flag || m >= n) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n" << n - m << '\n';
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; deg[i] < 2 && j <= n; ++j)
      if (deg[j] < 2 && root(i) != root(j)) {
        cout << i << ' ' << j << '\n';
        fa[fa[i]] = fa[j];
        ++deg[i], ++deg[j];
      }
  for (int i = 1; i <= n; ++i)
    if (deg[i] < 2)
      cout << i << ' ';
  cout << '\n';
}


#include<bits/stdc++.h>
using namespace std;

/*-------------------------------------------------------------
Interesting Graph and Apples：给你一个图，判断是否可以将所有点
都连成一条环，所有点都只在这一个环中，最后输出需要加边的最小边
数，且输出字典序最小的增加的边序列。
--------------------------------------------------------------*/
typedef long long ll;
typedef pair<int, int> P;
const int mod = 1e9 + 7;
const ll inf = 1e18;
const int INF = 1e9;
const int maxn = 2510;
const double eps=1e-5;

vector<int> G[60];
int fa[60];

int findest(int x){
	if(x == fa[x])return x;
	else return fa[x] = findest(fa[x]);
}

int main(){
    ios::sync_with_stdio(false);
    int n, m, x, y;
	cin >> n >> m;
	for(int i = 1; i <= n; i++){
		fa[i] = i;
	}
	for(int i = 1; i <= m; i++){
		cin >> x >> y;
		G[x].push_back(y);
		G[y].push_back(x);
		int u = findest(x), v = findest(y);
		if(u != v){
			fa[v] = u;
		}
	}
	for(int i = 1; i <= n; i++){
		if(G[i].size() > 2){
			cout << "NO\n";
			return 0;
		}
	}
	vector<P> ans;
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= n; j++){
			int u = findest(i);
			int v = findest(j);
			if(u != v && G[i].size() < 2 && G[j].size() < 2){
				fa[v] = u;
				G[i].push_back(j);
				G[j].push_back(i);
				ans.push_back(P(i, j));
			}
		}
	}
	x = findest(1);
	for(int i = 2; i <= n; i++){
		if(findest(i) != x){
			cout << "NO\n";
			return 0;
		}
	}
	x = 0;
	for(int i = 1; i <= n; i++){
		if(G[i].size() < 2){
			if(x == 0){
				x = i;
			}else{
				ans.push_back(P(x, i));
			}
		}
	}
	if(n == 1 && m == 0){
		ans.push_back(P(1, 1));
	}
	cout << "YES\n";
	cout << ans.size() << "\n";
	for(int i = 0; i < ans.size(); i++){
		cout << ans[i].first << " " << ans[i].second << "\n";
	}
	return 0;
}

/*-------------------------------------------------------------
并查集
--------------------------------------------------------------*/


#include <bits/stdc++.h>
#include <ext/algorithm>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define endl '\n'

const int N = 60;

int p[N];

int root(int x) { return p[x] < 0 ? x : p[x] = root(p[x]); }

bool join(int x, int y)
{
	if ((x = root(x)) != (y = root(y)))
	{
		if (p[x] > p[y])
			swap(x, y);
		p[x] += p[y];
		p[y] = x;

		return true;
	}

	return false;
}

bool g[N][N];
int deg[N];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n, m;
	cin >> n >> m;

	if (m > n)
		return cout << "NO" << endl, 0;

	memset(p, -1, sizeof p);

	for (int i = 0; i < m; ++i)
	{
		int u, v;
		cin >> u >> v;
		--u, --v;
		++deg[u]; ++deg[v];
		if (m < n && !join(u, v))
			return cout << "NO" << endl, 0;
	}

	for (int i = 0; i < n; ++i)
		if (deg[i] > 2)
			return cout << "NO" << endl, 0;

	if (-p[root(0)] == n && count(deg, deg + n, 2) == n)
		return cout << "YES" << endl << 0 << endl, 0;

	vector<pair<int,int>> ans;
	for (int i = 0; i < n; ++i)
		for (int k = deg[i]; k < 2; ++k)
			for (int j = i + 1; j < n; ++j)
				if (deg[j] < 2 && root(i) != root(j))
				{
					ans.push_back({i+1, j+1});
					++deg[i], ++deg[j];
					join(i, j);
					g[i][j] = g[j][i] = true;
					break;
				}

	for (int i = 0; i < n; ++i)
		if (deg[i] == 0)
			ans.push_back({i+1, i+1}), deg[i] = 2;

	for (int i = 0; i < n; ++i)
		if (deg[i] == 1)
			for (int j = i + 1; j < n; ++j)
				if (deg[j] == 1)
				{
					ans.push_back({i+1, j+1});
					++deg[i]; ++deg[j];
					break;
				}

	cout << "YES" << endl << ans.size() << endl;
	for (auto p : ans)
		cout << p.first << " " << p.second << endl;

	return 0;
}


#include <bits/stdc++.h>
#include <ext/algorithm>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define endl '\n'

const int N = 60;

int p[N];

int root(int x) { return p[x] < 0 ? x : p[x] = root(p[x]); }

bool join(int x, int y)
{
	if ((x = root(x)) != (y = root(y)))
	{
		if (p[x] > p[y])
			swap(x, y);
		p[x] += p[y];
		p[y] = x;

		return true;
	}

	return false;
}

bool g[N][N];
int deg[N];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n, m;
	cin >> n >> m;

	if (m > n)
		return cout << "NO" << endl, 0;

	memset(p, -1, sizeof p);

	for (int i = 0; i < m; ++i)
	{
		int u, v;
		cin >> u >> v;
		--u, --v;
		++deg[u]; ++deg[v];
		if (m < n && !join(u, v))
			return cout << "NO" << endl, 0;
	}

	for (int i = 0; i < n; ++i)
		if (deg[i] > 2)
			return cout << "NO" << endl, 0;

	if (n == m)
		if (-p[root(0)] == n && count(deg, deg + n, 2) == n)
			return cout << "YES" << endl << 0 << endl, 0;
		else return cout << "NO" << endl, 0;

	vector<pair<int,int>> ans;
	for (int i = 0; i < n; ++i)
		for (int k = deg[i]; k < 2; ++k)
			for (int j = i + 1; j < n; ++j)
				if (deg[j] < 2 && root(i) != root(j))
				{
					ans.push_back({i+1, j+1});
					++deg[i], ++deg[j];
					join(i, j);
					g[i][j] = g[j][i] = true;
					break;
				}

	for (int i = 0; i < n; ++i)
		if (deg[i] == 0)
			ans.push_back({i+1, i+1}), deg[i] = 2;

	for (int i = 0; i < n; ++i)
		if (deg[i] == 1)
			for (int j = i + 1; j < n; ++j)
				if (deg[j] == 1)
				{
					ans.push_back({i+1, j+1});
					++deg[i]; ++deg[j];
					break;
				}

	cout << "YES" << endl << ans.size() << endl;
	for (auto p : ans)
		cout << p.first << " " << p.second << endl;

	return 0;
}


#include <bits/stdc++.h>
#include <ext/algorithm>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define endl '\n'

const int N = 60;

int p[N];

int root(int x) { return p[x] < 0 ? x : p[x] = root(p[x]); }

bool join(int x, int y)
{
    if ((x = root(x)) != (y = root(y)))
    {
        if (p[x] > p[y])
            swap(x, y);
        p[x] += p[y];
        p[y] = x;

        return true;
    }

    return false;
}

bool g[N][N];
int deg[N];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n, m;
    cin >> n >> m;

    if (m > n)
        return cout << "NO" << endl, 0;

    memset(p, -1, sizeof p);

    for (int i = 0; i < m; ++i)
    {
        int u, v;
        cin >> u >> v;
        --u, --v;
        ++deg[u]; ++deg[v];
        if (!join(u, v) && m < n)
            return cout << "NO" << endl, 0;
    }

    for (int i = 0; i < n; ++i)
        if (deg[i] > 2)
            return cout << "NO" << endl, 0;

    if (n == m)
        if (-p[root(0)] == n && count(deg, deg + n, 2) == n)
            return cout << "YES" << endl << 0 << endl, 0;
        else return cout << "NO" << endl, 0;

    vector<pair<int,int>> ans;
    for (int i = 0; i < n; ++i)
        for (int k = deg[i]; k < 2; ++k)
            for (int j = i + 1; j < n; ++j)
                if (deg[j] < 2 && root(i) != root(j))
                {
                    ans.push_back({i+1, j+1});
                    ++deg[i], ++deg[j];
                    join(i, j);
                    g[i][j] = g[j][i] = true;
                    break;
                }

    for (int i = 0; i < n; ++i)
        if (deg[i] == 0)
            ans.push_back({i+1, i+1}), deg[i] = 2;

    for (int i = 0; i < n; ++i)
        if (deg[i] == 1)
            for (int j = i + 1; j < n; ++j)
                if (deg[j] == 1)
                {
                    ans.push_back({i+1, j+1});
                    ++deg[i]; ++deg[j];
                    break;
                }

    cout << "YES" << endl << ans.size() << endl;
    for (auto p : ans)
        cout << p.first << " " << p.second << endl;

    return 0;
}


#include <bits/stdc++.h>

typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(V) (int) V.size()
#define LN(V) (int) V.length()
#define ALL(V) V.begin(), V.end()
using namespace std;

const int N = 55;

int p[N], deg[N];

int parent (int v) {

    if (p[v] == v) return v;
    return p[v] = parent(p[v]);
}

void unite (int a, int b) {

    a = parent(a);
    b = parent(b);

    if (a == b) return;

    if (rand() & 1) swap(a, b);

    p[a] = b;
}

int n, m;
vector <pair <int, int> > res;

int main() {

    ios_base::sync_with_stdio(0);

    cin >> n >> m;

    for (int i = 1; i <= n; i++) p[i] = i;

    for (int i = 1; i <= m; i++) {

        int x, y; cin >> x >> y;

        deg[x]++; deg[y]++;

        if (parent(x) != parent(y))
            unite(x, y);
    }

    for (int i = 1; i <= n; i++) {

        for (int j = i + 1; j <= n; j++) {

            if (deg[i] < 2 && deg[j] < 2 && parent(i) != parent(j)) {

                res.pb(mp(i, j));
                unite(i, j); deg[i]++; deg[j]++;
            }
        }
    }

    for (int i = 1; i <= n; i++) {

        for (int j = i + 1; j <= n; j++) {

            if (deg[i] < 2 && deg[j] < 2) {

                res.pb(mp(i, j));
                deg[i]++; deg[j]++;
                unite(i, j);
            }
        }
    }

    for (int i = 1; i <= n; i++) {

        for (int j = i; j <= n; j++) {

            if (deg[i] < 2 && deg[j] < 2) {

                res.pb(mp(i, j));
                deg[i]++; deg[j]++;
                unite(i, j);
            }
        }
    }

    for (int i = 1; i <= n; i++)
        if (deg[i] != 2) return cout << "NO", 0;

    for (int i = 2; i <= n; i++)
        if (parent(i) != parent(i - 1)) return cout << "NO", 0;

    cout << "YES\n" << SZ(res) << "\n";

    for (int i = 0; i < SZ(res); i++)
        cout << res[i].fi << " " << res[i].se << "\n";

    return 0;
}


#include <bits/stdc++.h>

typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(V) (int) V.size()
#define LN(V) (int) V.length()
#define ALL(V) V.begin(), V.end()
using namespace std;

const int N = 55;

int p[N], deg[N];

int parent (int v) {

    if (p[v] == v) return v;
    return p[v] = parent(p[v]);
}

void unite (int a, int b) {

    a = parent(a);
    b = parent(b);

    if (a == b) return;

    if (rand() & 1) swap(a, b);

    p[a] = b;
}

int n, m;
vector <pair <int, int> > res;

int main() {

    ios_base::sync_with_stdio(0);

    cin >> n >> m;

    for (int i = 1; i <= n; i++) p[i] = i;

    for (int i = 1; i <= m; i++) {

        int x, y; cin >> x >> y;

        deg[x]++; deg[y]++;

        if (parent(x) != parent(y))
            unite(x, y);
    }

    for (int i = 1; i <= n; i++) {

        for (int j = i + 1; j <= n; j++) {

            if (deg[i] < 2 && deg[j] < 2 && parent(i) != parent(j)) {

                res.pb(mp(i, j));
                unite(i, j); deg[i]++; deg[j]++;
            }
        }
    }

    for (int i = 1; i <= n; i++) {

        for (int j = i + 1; j <= n; j++) {

            if (deg[i] < 2 && deg[j] < 2) {

                res.pb(mp(i, j));
                deg[i]++; deg[j]++;
                unite(i, j);
            }
        }
    }

    for (int i = 1; i <= n; i++) {

        for (int j = i; j <= n; j++) {

            if (deg[i] < 2 && deg[j] < 2) {

                res.pb(mp(i, j));
                deg[i]++; deg[j]++;
                unite(i, j);
            }
        }
    }

    for (int i = 1; i <= n; i++)
        if (deg[i] != 2) return cout << "NO", 0;

    for (int i = 2; i <= n; i++)
        if (parent(i) != parent(i - 1)) cout << "NO", 0;

    cout << "YES\n" << SZ(res) << "\n";

    for (int i = 0; i < SZ(res); i++)
        cout << res[i].fi << " " << res[i].se << "\n";

    return 0;
}


#include <bits/stdc++.h>

typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define SZ(V) (int) V.size()
#define LN(V) (int) V.length()
#define ALL(V) V.begin(), V.end()
using namespace std;

const int N = 55;

int p[N], deg[N];

int parent (int v) {

    if (p[v] == v) return v;
    return p[v] = parent(p[v]);
}

void unite (int a, int b) {

    a = parent(a);
    b = parent(b);

    if (a == b) return;

    if (rand() & 1) swap(a, b);

    p[a] = b;
}

int n, m;
vector <pair <int, int> > res;

int main() {

    ios_base::sync_with_stdio(0);

    cin >> n >> m;

    for (int i = 1; i <= n; i++) p[i] = i;

    for (int i = 1; i <= m; i++) {

        int x, y; cin >> x >> y;

        deg[x]++; deg[y]++;

        if (parent(x) != parent(y))
            unite(x, y);
    }

    for (int i = 1; i <= n; i++) {

        for (int j = i + 1; j <= n; j++) {

            if (deg[i] < 2 && deg[j] < 2 && parent(i) != parent(j)) {

                res.pb(mp(i, j));
                unite(i, j); deg[i]++; deg[j]++;
            }
        }
    }

    for (int i = 1; i <= n; i++) {

        for (int j = i + 1; j <= n; j++) {

            if (deg[i] < 2 && deg[j] < 2) {

                res.pb(mp(i, j));
                deg[i]++; deg[j]++;
                unite(i, j);
            }
        }
    }

    for (int i = 1; i <= n; i++) {

        for (int j = i; j <= n; j++) {

            if (deg[i] < 2 && deg[j] < 2) {

                res.pb(mp(i, j));
                deg[i]++; deg[j]++;
                unite(i, j);
            }
        }
    }

    for (int i = 1; i <= n; i++)
        if (deg[i] < 2) return cout << "NO", 0;

    for (int i = 2; i <= n; i++)
        if (parent(i) != parent(i - 1)) cout << "NO", 0;

    cout << "YES\n" << SZ(res) << "\n";

    for (int i = 0; i < SZ(res); i++)
        cout << res[i].fi << " " << res[i].se << "\n";

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
#define fi first
#define se second
#define pb push_back
const int MAXN=10086;
int dep[MAXN];
int from[MAXN];
int sum1[MAXN],sum2[MAXN];
int cyc1[MAXN],cyc2[MAXN];
int vist1[MAXN],vist2[MAXN];
int n,m,m1,m2;
vector<pii> edge[MAXN];
inline void dfs(int u,int far){
	for(auto p : edge[u]){
		int v=p.fi;
		if(v==far) continue;
		if(!dep[v]){
			from[v]=p.se;
			dep[v]=dep[u]+1;
			dfs(v,u);
			sum1[u]+=sum1[v];
			sum2[u]+=sum2[v];
		}
		else if(dep[v]<dep[u]){
			if((dep[v]+dep[u])&1){
				++m1,vist1[p.se]=1;
				++cyc1[u],--cyc1[v];
			}
			else{
				++m2,vist2[p.se]=1;
				++cyc2[u],--cyc2[v];
			}
		}
	}
	sum1[u]+=cyc1[u];
	sum2[u]+=cyc2[u];
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;++i){
		int u,v;
		scanf("%d%d",&u,&v);
		edge[u].pb(pii(v,i));
		edge[v].pb(pii(u,i));
	}
	for(int i=1;i<=n;++i){
		if(!dep[i]) dep[i]=1,dfs(i,0);
	}
	vector<int> ans;
	if(!m2){
		for(int i=1;i<=m;++i) ans.pb(i);
	}
	else{
		for(int i=1;i<=n;++i){
			if(!sum1[i]&&sum2[i]==m2){
				ans.pb(from[i]);
			}
		}
		if(m2==1){
			for(int i=1;i<=m;++i){
				if(vist2[i]){ ans.pb(i); break; }
			}
		}
	}
	cout<<ans.size()<<endl;
	sort(ans.begin(),ans.end());
	for(auto p : ans){
		printf("%d ",p);
	}
	puts("");
	return 0;
}


#include <iostream>
#include <bitset>
#include <cstdio>
#include <queue>
#include <stack>
#include <cstring>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <vector>
using namespace std;
typedef long long ll;
const int maxn = 60;
struct node{
    int fa[maxn];
    void init(){
        for (int i = 0;i < maxn;i++){
            fa[i] = i;
        }
    }
    int found(int x) {return fa[x] = fa[x]==x?x:found(fa[x]);}
    bool combine(int x,int y){
        int a = found(x),b = found(y);
        if(a==b) return 0;
        else fa[b] = a;
        return 1;
    }
} uf;

int n,m;
int s[maxn];
int main()
{
    while(scanf("%d%d",&n,&m)!=EOF){
        bool flag = 1;
        uf.init();
        for (int i = 0;i <= n;i++) s[i] = 2;
        for (int i = 0;i < m;i++){
            int c,d;
            scanf("%d %d",&c,&d);
            s[c]--,s[d]--;
            if(s[c]<0||s[d]<0) flag = 0;
            if(uf.found(c)==uf.found(d)&&i!=n-1)
                flag = 0;
            uf.combine(c,d);
        }
        if(flag){
            puts("YES");
            printf("%d\n",n-m);
            for (int i = 1;i <= n;i++){
                //cout<<uf.fa[i]<<" ";
                for (int q = 0;q <= 1;q++)
                {
                    for (int j = i+1;j <= n;j++)
                    {
                        if(s[i]&&s[j]&&uf.combine(i,j)){
                            s[i]--,s[j]--;
                            printf("%d %d\n",i,j);
                        }
                    }
                }
            }
            int cnt = 1;
            for (int i = 1;i <= n;i++)
            {
                while(s[i]--){
                    printf("%d",i);
                    if(cnt) {
                        printf(" ");
                        cnt = 0;
                    }
                    else {
                        printf("\n");
                        cnt = 1;
                    }
                }
            }
        }
        else puts("NO");
    }
    return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;

const ll N=60,M=2510;
ll n,m,tot,indegree[N],father[N];
pair<ll,ll> ans[M];

inline ll read(){
	ll x=0,tmp=1;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') tmp=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<3)+(x<<1)+(ch^48);
		ch=getchar();
	}
	return tmp*x;
}

inline void write(ll x){
	if(x<0){
		putchar('-');
		x=-x;
	}
	ll y=10,len=1;
	while(y<=x){
		y=(y<<3)+(y<<1);
		len++;
	}
	while(len--){
		y/=10;
		putchar(x/y+48);
		x%=y;
	}
}

ll searchfather(ll v){
	return father[v]==v?father[v]:father[v]=searchfather(father[v]);
}

int main(){
	n=read(); m=read();
	for(ll i=1; i<=n; i++) father[i]=i;
	for(ll i=1; i<=m; i++){
		ll x=read(),y=read();
		indegree[x]++;
		indegree[y]++;
		if(indegree[x]>2||indegree[y]>2) return printf("NO")&0;
		ll f1=searchfather(x),f2=searchfather(y);
		father[f1]=f2;
	}
	for(ll i=1; i<=n; i++){
		for(ll j=i+1; j<=n; j++){
			if(searchfather(i)!=searchfather(j)){
				if(indegree[i]>2||indegree[j]>2) continue;
				ll f1=searchfather(i),f2=searchfather(j);
				father[f1]=f2;
				indegree[i]++;
				indegree[j]++;
				ans[++tot]=make_pair(i,j);
			}
		}
	}
	if(m+tot==n-1){
        tot++;
        for(ll i=1; i<=n; i++){
            while(indegree[i]<2){
                indegree[i]++;
                if(!ans[tot].first) ans[tot].first=i;
                else ans[tot].second=i;
            }
        }
    }
	for(ll i=1; i<=n; i++){
		if(searchfather(i)!=searchfather(1)) return printf("NO")&0;
	}
	sort(ans+1,ans+1+tot);
	puts("YES");
	write(tot); putchar('\n');
	for(ll i=1; i<=tot; i++){
		write(ans[i].first); putchar(' ');
		write(ans[i].second); putchar('\n');
	}
	return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;

const ll N=60,M=2510;
ll n,m,tot,indegree[N],father[N];
pair<ll,ll> ans[M];

inline ll read(){
	ll x=0,tmp=1;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') tmp=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<3)+(x<<1)+(ch^48);
		ch=getchar();
	}
	return tmp*x;
}

inline void write(ll x){
	if(x<0){
		putchar('-');
		x=-x;
	}
	ll y=10,len=1;
	while(y<=x){
		y=(y<<3)+(y<<1);
		len++;
	}
	while(len--){
		y/=10;
		putchar(x/y+48);
		x%=y;
	}
}

ll searchfather(ll v){
	return father[v]==v?father[v]:father[v]=searchfather(father[v]);
}

int main(){
	n=read(); m=read();
	for(ll i=1; i<=n; i++) father[i]=i;
	for(ll i=1; i<=m; i++){
		ll x=read(),y=read();
		indegree[x]++;
		indegree[y]++;
		if(indegree[x]>2&&indegree[y]>2) return printf("NO")&0;
		ll f1=searchfather(x),f2=searchfather(y);
		father[f1]=f2;
	}
	for(ll i=1; i<=n; i++){
		if(indegree[i]==2) continue;
		for(ll j=i+1; j<=n; j++){
			if(indegree[j]==2) continue;
			if(searchfather(i)!=searchfather(j)){
				ll f1=searchfather(i),f2=searchfather(j);
				father[f1]=f2;
				indegree[i]++;
				indegree[j]++;
				ans[++tot]=make_pair(i,j);
			}
		}
	}
	if(m+tot==(n==2?0:n-1)){
        tot++;
        for(ll i=1; i<=n; i++){
            while(indegree[i]<2){
                indegree[i]++;
                if(!ans[tot].first) ans[tot].first=i;
                else ans[tot].second=i;
            }
        }
    }
	for(ll i=1; i<=n; i++){
		if(searchfather(i)!=searchfather(1)) return printf("NO")&0;
	}
	sort(ans+1,ans+1+tot);
	puts("YES");
	write(tot); putchar('\n');
	for(ll i=1; i<=tot; i++){
		write(ans[i].first); putchar(' ');
		write(ans[i].second); putchar('\n');
	}
	return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;

const ll N=60,M=2510;
ll n,m,tot,indegree[N],father[N];
pair<ll,ll> ans[M];

inline ll read(){
	ll x=0,tmp=1;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') tmp=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<3)+(x<<1)+(ch^48);
		ch=getchar();
	}
	return tmp*x;
}

inline void write(ll x){
	if(x<0){
		putchar('-');
		x=-x;
	}
	ll y=10,len=1;
	while(y<=x){
		y=(y<<3)+(y<<1);
		len++;
	}
	while(len--){
		y/=10;
		putchar(x/y+48);
		x%=y;
	}
}

ll searchfather(ll v){
	return father[v]==v?father[v]:father[v]=searchfather(father[v]);
}

int main(){
	n=read(); m=read();
	for(ll i=1; i<=n; i++) father[i]=i;
	for(ll i=1; i<=m; i++){
		ll x=read(),y=read();
		indegree[x]++;
		indegree[y]++;
		if(indegree[x]>2&&indegree[y]>2) return printf("NO")&0;
		ll f1=searchfather(x),f2=searchfather(y);
		father[f1]=f2;
	}
	for(ll i=1; i<=n; i++){
		if(indegree[i]==2) continue;
		for(ll j=1; j<=n; j++){
			if(indegree[j]==2) continue;
			if(searchfather(i)!=searchfather(j)){
				indegree[i]++;
				indegree[j]++;
				ans[++tot]=make_pair(i,j);
			}
		}
	}
	if(m+tot==n-1){
        tot++;
        for(ll i=1; i<=n; i++){
            while(indegree[i]<2){
                indegree[i]++;
                if(!ans[tot].first) ans[tot].first=i;
                else ans[tot].second=i;
            }
        }
    }
	for(ll i=1; i<=n; i++){
		if(searchfather(i)!=searchfather(1)) return printf("NO")&0;
	}
	sort(ans+1,ans+1+tot);
	puts("YES");
	write(tot); putchar('\n');
	for(ll i=1; i<=tot; i++){
		write(ans[i].first); putchar(' ');
		write(ans[i].second); putchar('\n');
	}
	return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;

const ll N=60,M=2510;
ll n,m,tot,indegree[N],father[N];
pair<ll,ll> ans[M];

inline ll read(){
	ll x=0,tmp=1;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') tmp=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<3)+(x<<1)+(ch^48);
		ch=getchar();
	}
	return tmp*x;
}

inline void write(ll x){
	if(x<0){
		putchar('-');
		x=-x;
	}
	ll y=10,len=1;
	while(y<=x){
		y=(y<<3)+(y<<1);
		len++;
	}
	while(len--){
		y/=10;
		putchar(x/y+48);
		x%=y;
	}
}

ll searchfather(ll v){
	return father[v]==v?father[v]:father[v]=searchfather(father[v]);
}

int main(){
	n=read(); m=read();
	for(ll i=1; i<=n; i++) father[i]=i;
	for(ll i=1; i<=m; i++){
		ll x=read(),y=read();
		indegree[x]++;
		indegree[y]++;
		if(indegree[x]>2||indegree[y]>2) return printf("NO")&0;
		ll f1=searchfather(x),f2=searchfather(y);
		father[f1]=f2;
	}
	for(ll i=1; i<=n; i++){
		if(indegree[i]==2) continue;
		for(ll j=i+1; j<=n; j++){
			if(indegree[j]==2) continue;
			if(searchfather(i)!=searchfather(j)){
				ll f1=searchfather(i),f2=searchfather(j);
				father[f1]=f2;
				indegree[i]++;
				indegree[j]++;
				ans[++tot]=make_pair(i,j);
			}
		}
	}
	if(m+tot==n-1){
        tot++;
        for(ll i=1; i<=n; i++){
            while(indegree[i]<2){
                indegree[i]++;
                if(!ans[tot].first) ans[tot].first=i;
                else ans[tot].second=i;
            }
        }
    }
	for(ll i=1; i<=n; i++){
		if(searchfather(i)!=searchfather(1)) return printf("NO")&0;
	}
	sort(ans+1,ans+1+tot);
	puts("YES");
	write(tot); putchar('\n');
	for(ll i=1; i<=tot; i++){
		write(ans[i].first); putchar(' ');
		write(ans[i].second); putchar('\n');
	}
	return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;

const ll N=60;
ll n,m,tot,indegree[N],father[N];
pair<ll,ll> ans[N];

inline ll read(){
	ll x=0,tmp=1;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') tmp=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<3)+(x<<1)+(ch^48);
		ch=getchar();
	}
	return tmp*x;
}

inline void write(ll x){
	if(x<0){
		putchar('-');
		x=-x;
	}
	ll y=10,len=1;
	while(y<=x){
		y=(y<<3)+(y<<1);
		len++;
	}
	while(len--){
		y/=10;
		putchar(x/y+48);
		x%=y;
	}
}

ll searchfather(ll v){
	return father[v]==v?father[v]:father[v]=searchfather(father[v]);
}

int main(){
	n=read(); m=read();
	if(n<m) return printf("NO")&0;
	for(ll i=1; i<=n; i++) father[i]=i;
	for(ll i=1; i<=m; i++){
		ll x=read(),y=read();
		indegree[x]++;
		indegree[y]++;
		if(indegree[x]>2||indegree[y]>2) return printf("NO")&0;
		ll f1=searchfather(x),f2=searchfather(y);
		father[f1]=f2;
	}
	for(ll i=1; i<=n; i++){
		for(ll j=i+1; j<=n; j++){
			if(searchfather(i)!=searchfather(j)){
				if(indegree[i]>=2||indegree[j]>=2) continue;
				ll f1=searchfather(i),f2=searchfather(j);
				father[f1]=f2;
				indegree[i]++;
				indegree[j]++;
				ans[++tot]=make_pair(i,j);
			}
		}
	}
	if(m+tot==n-1){
        tot++;
        for(ll i=1; i<=n; i++){
            while(indegree[i]<2){
                indegree[i]++;
                if(!ans[tot].first) ans[tot].first=i;
                else ans[tot].second=i;
            }
        }
    }
	for(ll i=1; i<=n; i++){
		if(searchfather(i)!=searchfather(1)) return printf("NO")&0;
	}
	sort(ans+1,ans+1+tot);
	puts("YES");
	write(tot); putchar('\n');
	for(ll i=1; i<=tot; i++){
		write(ans[i].first); putchar(' ');
		write(ans[i].second); putchar('\n');
	}
	return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;

const ll N=60;
ll n,m,tot,indegree[N],father[N];
pair<ll,ll> ans[N];

inline ll read(){
	ll x=0,tmp=1;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') tmp=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<3)+(x<<1)+(ch^48);
		ch=getchar();
	}
	return tmp*x;
}

inline void write(ll x){
	if(x<0){
		putchar('-');
		x=-x;
	}
	ll y=10,len=1;
	while(y<=x){
		y=(y<<3)+(y<<1);
		len++;
	}
	while(len--){
		y/=10;
		putchar(x/y+48);
		x%=y;
	}
}

ll searchfather(ll v){
	return father[v]==v?father[v]:father[v]=searchfather(father[v]);
}

int main(){
	n=read(); m=read();
	if(n<m) return printf("NO")&0;
	for(ll i=1; i<=n; i++) father[i]=i;
	for(ll i=1; i<=m; i++){
		ll x=read(),y=read();
		indegree[x]++;
		indegree[y]++;
		if(indegree[x]>2||indegree[y]>2) return printf("NO")&0;
		ll f1=searchfather(x),f2=searchfather(y);
		father[f1]=f2;
	}
	for(ll i=1; i<=n; i++){
		for(ll j=i+1; j<=n; j++){
			if(searchfather(i)!=searchfather(j)){
				if(indegree[i]>2||indegree[j]>2) continue;
				ll f1=searchfather(i),f2=searchfather(j);
				father[f1]=f2;
				indegree[i]++;
				indegree[j]++;
				ans[++tot]=make_pair(i,j);
			}
		}
	}
	if(m+tot==n-1){
        tot++;
        for(ll i=1; i<=n; i++){
            while(indegree[i]<2){
                indegree[i]++;
                if(!ans[tot].first) ans[tot].first=i;
                else ans[tot].second=i;
            }
        }
    }
	for(ll i=1; i<=n; i++){
		if(searchfather(i)!=searchfather(1)) return printf("NO")&0;
	}
	sort(ans+1,ans+1+tot);
	puts("YES");
	write(tot); putchar('\n');
	for(ll i=1; i<=tot; i++){
		write(ans[i].first); putchar(' ');
		write(ans[i].second); putchar('\n');
	}
	return 0;
}


#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;

const ll N=60,M=2510;
ll n,m,tot,indegree[N],father[N];
pair<ll,ll> ans[M];

inline ll read(){
	ll x=0,tmp=1;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-') tmp=-1;
		ch=getchar();
	}
	while(isdigit(ch)){
		x=(x<<3)+(x<<1)+(ch^48);
		ch=getchar();
	}
	return tmp*x;
}

inline void write(ll x){
	if(x<0){
		putchar('-');
		x=-x;
	}
	ll y=10,len=1;
	while(y<=x){
		y=(y<<3)+(y<<1);
		len++;
	}
	while(len--){
		y/=10;
		putchar(x/y+48);
		x%=y;
	}
}

ll searchfather(ll v){
	return father[v]==v?father[v]:father[v]=searchfather(father[v]);
}

int main(){
	n=read(); m=read();
	for(ll i=1; i<=n; i++) father[i]=i;
	for(ll i=1; i<=m; i++){
		ll x=read(),y=read();
		indegree[x]++;
		indegree[y]++;
		if(indegree[x]>2&&indegree[y]>2) return printf("NO")&0;
		ll f1=searchfather(x),f2=searchfather(y);
		father[f1]=f2;
	}
	for(ll i=1; i<=n; i++){
		if(indegree[i]==2) continue;
		for(ll j=i+1; j<=n; j++){
			if(indegree[j]==2) continue;
			if(searchfather(i)!=searchfather(j)){
				ll f1=searchfather(i),f2=searchfather(j);
				father[f1]=f2;
				indegree[i]++;
				indegree[j]++;
				ans[++tot]=make_pair(i,j);
			}
		}
	}
	if(m+tot==n-1){
        tot++;
        for(ll i=1; i<=n; i++){
            while(indegree[i]<2){
                indegree[i]++;
                if(!ans[tot].first) ans[tot].first=i;
                else ans[tot].second=i;
            }
        }
    }
	for(ll i=1; i<=n; i++){
		if(searchfather(i)!=searchfather(1)) return printf("NO")&0;
	}
	sort(ans+1,ans+1+tot);
	puts("YES");
	write(tot); putchar('\n');
	for(ll i=1; i<=tot; i++){
		write(ans[i].first); putchar(' ');
		write(ans[i].second); putchar('\n');
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int fa[55];
int e1[2510],e2[2510];
int degree[55];
vector<pair<int,int>>ans;
int find(int x)
{
	return fa[x]==x?x:fa[x]=find(fa[x]);
}
void Union(int x,int y)
{
	int p1=find(x);
	int p2=find(y);
	if(p1!=p2){
		fa[p2]=p1;
	}

}
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>e1[i]>>e2[i];
	}
	for(int i=1;i<=n;i++) fa[i]=i;
	for(int i=1;i<=m;i++)
	{
		Union(e1[i],e2[i]);
		degree[e1[i]]++;
		degree[e2[i]]++;
		if(degree[e1[i]]>2 || degree[e2[i]]>2)
		return 0*printf("NO");
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<i;j++)
		{
			if(degree[j]<=1 && degree[i]<=1 &&find(i)!=find(j))
			{
				ans.push_back(make_pair(j,i));
				Union(i,j);
				degree[i]++;
				degree[j]++;
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(degree[i]==2)continue;
		for(int j=1;j<i;j++)
		{
			if(degree[i]==1)
			{
				ans.push_back(make_pair(j,i));
				Union(i,j);
				degree[i]++;
				degree[j]++;
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(degree[i]==0){
			ans.push_back(make_pair(i,i));
		}
	}
	int p = find(1);
	for(int i=1;i<=n;i++)
	{
		if(find(i)!=p) return 0*printf("NO");
	}
	puts("YES");
	sort(ans.begin(),ans.end());
	cout<<ans.size()<<endl;
	for(int i=0;i<ans.size();i++)
	{
		cout<<ans[i].first<<" "<<ans[i].second<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int fa[55];
int e1[2510],e2[2510];
int degree[55];
vector<pair<int,int>>ans;
int find(int x)
{
	return fa[x]==x?x:fa[x]=find(fa[x]);
}
void Union(int x,int y)
{
	int p1=find(x);
	int p2=find(y);
	if(p1!=p2){
		fa[p2]=p1;
	}

}
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>e1[i]>>e2[i];
	}
	for(int i=1;i<=n;i++) fa[i]=i;
	for(int i=1;i<=m;i++)
	{
		Union(e1[i],e2[i]);
		degree[e1[i]]++;
		degree[e2[i]]++;
		if(degree[e1[i]]>2 || degree[e2[i]]>2)
		return 0*printf("NO");
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<i;j++)
		{
			if(degree[i]<=1 && degree[j]<=1  && find(i)!=find(j))
			{
				ans.push_back(make_pair(j,i));
				Union(i,j);
				degree[i]++;
				degree[j]++;
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(degree[i]==2)continue;
		for(int j=1;j<i;j++)
		{
			if(degree[j]==1)
			{
				ans.push_back(make_pair(j,i));
				Union(i,j);
				degree[i]++;
				degree[j]++;
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(degree[i]==0){
			ans.push_back(make_pair(i,i));
		}
	}

	int p = find(1);
	for(int i=1;i<=n;i++)
	{
		if(find(i)!=p) return 0*printf("NO");
	}
	puts("YES");
	sort(ans.begin(),ans.end());
	cout<<ans.size()<<endl;
	for(int i=0;i<ans.size();i++)
	{
		cout<<ans[i].first<<" "<<ans[i].second<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int fa[55];
int e1[55],e2[55];
int degree[55];
vector<pair<int,int>>ans;
int find(int x)
{
	return fa[x]==x?x:fa[x]=find(fa[x]);
}
void Union(int x,int y)
{
	int p1=find(x);
	int p2=find(y);
	if(p1!=p2){
		fa[p2]=p1;
	}

}
int main()
{
	int n,m;
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		cin>>e1[i]>>e2[i];
	}
	for(int i=1;i<=n;i++) fa[i]=i;
	for(int i=1;i<=m;i++)
	{
		Union(e1[i],e2[i]);
		degree[e1[i]]++; degree[e2[i]]++;
		if(degree[e1[i]]>2 || degree[e2[i]]>2)
		return 0*printf("NO");
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<i;j++)
		{
			if(degree[j]<=1 && degree[i]<=1 &&find(i)!=find(j))
			{
				ans.push_back(make_pair(j,i));
				Union(i,j);
				degree[i]++;
				degree[j]++;
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(degree[i]==2)continue;
		for(int j=1;j<i;j++)
		{
			if(degree[i]==1)
			{
				ans.push_back(make_pair(j,i));
				Union(i,j);
				degree[i]++;
				degree[j]++;
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(degree[i]==0){
			ans.push_back(make_pair(i,i));
		}
	}
	int p = find(1);
	for(int i=1;i<=n;i++)
	{
		if(find(i)!=p) return 0*printf("NO");
	}
	puts("YES");
	sort(ans.begin(),ans.end());
	cout<<ans.size()<<endl;
	for(int i=0;i<ans.size();i++)
	{
		cout<<ans[i].first<<" "<<ans[i].second<<endl;
	}
	return 0;
}


#include<iostream>
#include<vector>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<cstring>
#include<algorithm>
#include<deque>
#include<unordered_map>
#include<iomanip>

#define mp make_pair
#define ft first
#define sd second
#define pb push_back
#define ll long long
#define ld double
#define lF long double
#define POP pop_back()
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define FOR(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define _FOR(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define mod 1000000007
#define eps 1e-9
#define MEM(x,y) memset(x,y,sizeof(x))

using namespace std;

typedef pair<int,int>pii;

int const N = 55;

int n, m;

int adj[N][N], deg[N];

int par[N], sz[N];
int root(int v){
          if(par[v] == v) return v;
          return root(par[v]);
}
void merge(int x, int y){
          x = root(x), y = root(y);
          if(x == y) return;
          if(sz[y] > sz[x]) swap(x,y);
          par[y] = x;
          sz[x] += sz[y];
}

vector<pii> ans;

int main(){

	cin.sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> n >> m;

	FOR(i,1,n) par[i] = i, sz[i] = 1;

	FOR(i,1,m){
	          int u, v;
	          cin >> u >> v;
	          adj[u][v]++;
	          adj[v][u]++;
	          deg[u]++;
	          deg[v]++;
	          merge(u,v);
	}

	if(m > n){
	          cout << "NO" << '\n';
	          return 0;
	}

	FOR(i,1,n)
	 FOR(j,1,n)
	  if(adj[i][j] > 1 || deg[i] > 2){
	            cout << "NO" << '\n';
	            return 0;
	  }

          int ok = 1;
          FOR(i,1,n)
           if(root(i) != root(1) || deg[i] != 2) ok = 0;

          if(ok){
                    cout << "YES" << '\n' << "0" << '\n';
                    return 0;
          }

          cout << "YES" << '\n';

          if(n == 1){
                    cout << "1\n1 1" << '\n';
                    return 0;
          }

          while(1){
                    int x = -1, y = -1;
                    FOR(i,1,n){
                              if(deg[i] < 2){
                                        if(x == -1) x = i;
                                        else if(root(i) != root(x)) y = i;
                              }
                    }
                    if(x == -1) break;
                    if(y == -1) FOR(i,1,n) if(deg[i] < 2 && i != x) y = i;
                    deg[x]++, deg[y]++;
                    merge(x,y);
                    ans.push_back(pii(x,y));
          }

          cout << ans.size() << '\n';
          for(auto i: ans) cout << i.first << " " << i.second << '\n';
          return 0;

}


#include<iostream>
#include<vector>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<cstring>
#include<algorithm>
#include<deque>
#include<unordered_map>
#include<iomanip>

#define mp make_pair
#define ft first
#define sd second
#define pb push_back
#define ll long long
#define ld double
#define lF long double
#define POP pop_back()
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define FOR(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define _FOR(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define mod 1000000007
#define eps 1e-9
#define MEM(x,y) memset(x,y,sizeof(x))

using namespace std;

typedef pair<int,int>pii;

int const N = 55;

int n, m;

int adj[N][N], deg[N];

int par[N], sz[N];
int root(int v){
          if(par[v] == v) return v;
          return root(par[v]);
}
void merge(int x, int y){
          x = root(x), y = root(y);
          if(x == y) return;
          if(sz[y] > sz[x]) swap(x,y);
          par[y] = x;
          sz[x] += sz[y];
}

vector<pii> ans;

int main(){

	cin.sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> n >> m;

	FOR(i,1,n) par[i] = i, sz[i] = 1;

	FOR(i,1,m){
	          int u, v;
	          cin >> u >> v;
	          adj[u][v]++;
	          adj[v][u]++;
	          deg[u]++;
	          deg[v]++;
	          merge(u,v);
	}

	if(n == 1){
	          if(!m){
	                    cout << "YES\n1\n1 1\n";
	                    return 0;
	          }
	          else if(m == 1 && deg[1] == 2){
	                    cout << "YES\n0\n";
	                    return 0;
	          }
	          else cout << "NO";
	          return 0;
	}

	if(m > n){
	          cout << "NO" << '\n';
	          return 0;
	}

	FOR(i,1,n)
	 FOR(j,1,n)
	  if(deg[i] > 2){
	            cout << "NO" << '\n';
	            return 0;
	  }

          int ok = 1;
          FOR(i,1,n)
           if(root(i) != root(1) || deg[i] != 2) ok = 0;

          if(ok){
                    cout << "YES" << '\n' << "0" << '\n';
                    return 0;
          }

          while(1){
                    int x = -1, y = -1;
                    FOR(i,1,n){
                              if(deg[i] < 2){
                                        if(x == -1) x = i;
                                        else if(root(i) != root(x) && y != -1) y = i;
                              }
                    }
                    if(x == -1) break;
                    if(y == -1) FOR(i,1,n) if(deg[i] < 2 && i != x) y = i;
                    deg[x]++, deg[y]++;
                    merge(x,y);
                    ans.push_back(pii(x,y));
          }

          FOR(i,1,n)
           if(root(i) != root(1)){
                     cout << "NO" << '\n';
                     return 0;
           }

          cout << "YES" << '\n';
          cout << ans.size() << '\n';
          for(auto i: ans) cout << i.first << " " << i.second << '\n';
          return 0;

}


#include<iostream>
#include<vector>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<cstring>
#include<algorithm>
#include<deque>
#include<unordered_map>
#include<iomanip>

#define mp make_pair
#define ft first
#define sd second
#define pb push_back
#define ll long long
#define ld double
#define lF long double
#define POP pop_back()
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define FOR(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define _FOR(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define mod 1000000007
#define eps 1e-9
#define MEM(x,y) memset(x,y,sizeof(x))

using namespace std;

typedef pair<int,int>pii;

int const N = 55;

int n, m;

int adj[N][N], deg[N];

int par[N], sz[N];
int root(int v){
          if(par[v] == v) return v;
          return root(par[v]);
}
void merge(int x, int y){
          x = root(x), y = root(y);
          if(x == y) return;
          if(sz[y] > sz[x]) swap(x,y);
          par[y] = x;
          sz[x] += sz[y];
}

vector<pii> ans;

int main(){

	cin.sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> n >> m;

	FOR(i,1,n) par[i] = i, sz[i] = 1;

	FOR(i,1,m){
	          int u, v;
	          cin >> u >> v;
	          adj[u][v]++;
	          adj[v][u]++;
	          deg[u]++;
	          deg[v]++;
	          merge(u,v);
	}

	if(n == 1){
	          if(!m){
	                    cout << "YES\n1\n1 1\n";
	                    return 0;
	          }
	          else if(m == 1 && deg[1] == 2){
	                    cout << "YES\n0\n";
	                    return 0;
	          }
	          else cout << "NO";
	          return 0;
	}

	if(m > n){
	          cout << "NO" << '\n';
	          return 0;
	}

	FOR(i,1,n)
	 FOR(j,1,n)
	  if(adj[i][j] > 1 || deg[i] > 2){
	            cout << "NO" << '\n';
	            return 0;
	  }

          int ok = 1;
          FOR(i,1,n)
           if(root(i) != root(1) || deg[i] != 2) ok = 0;

          if(ok){
                    cout << "YES" << '\n' << "0" << '\n';
                    return 0;
          }

          cout << "YES" << '\n';

          while(1){
                    int x = -1, y = -1;
                    FOR(i,1,n){
                              if(deg[i] < 2){
                                        if(x == -1) x = i;
                                        else if(root(i) != root(x)) y = i;
                              }
                    }
                    if(x == -1) break;
                    if(y == -1) FOR(i,1,n) if(deg[i] < 2 && i != x) y = i;
                    deg[x]++, deg[y]++;
                    merge(x,y);
                    ans.push_back(pii(x,y));
          }

          cout << ans.size() << '\n';
          for(auto i: ans) cout << i.first << " " << i.second << '\n';
          return 0;

}


#include<iostream>
#include<vector>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<cstring>
#include<algorithm>
#include<deque>
#include<unordered_map>
#include<iomanip>

#define mp make_pair
#define ft first
#define sd second
#define pb push_back
#define ll long long
#define ld double
#define lF long double
#define POP pop_back()
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define FOR(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define _FOR(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define mod 1000000007
#define eps 1e-9
#define MEM(x,y) memset(x,y,sizeof(x))

using namespace std;

typedef pair<int,int>pii;

int const N = 55;

int n, m;

int adj[N][N], deg[N];

int par[N], sz[N];
int root(int v){
          if(par[v] == v) return v;
          return root(par[v]);
}
void merge(int x, int y){
          x = root(x), y = root(y);
          if(x == y) return;
          if(sz[y] > sz[x]) swap(x,y);
          par[y] = x;
          sz[x] += sz[y];
}

vector<pii> ans;

int main(){

	cin.sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> n >> m;

	FOR(i,1,n) par[i] = i, sz[i] = 1;

	FOR(i,1,m){
	          int u, v;
	          cin >> u >> v;
	          adj[u][v]++;
	          adj[v][u]++;
	          deg[u]++;
	          deg[v]++;
	          merge(u,v);
	}

	if(n == 1){
	          if(!m){
	                    cout << "YES\n1\n1 1\n";
	                    return 0;
	          }
	          else if(m == 1 && deg[1] == 2){
	                    cout << "YES\n0\n";
	                    return 0;
	          }
	          else cout << "NO";
	          return 0;
	}

	if(m > n){
	          cout << "NO" << '\n';
	          return 0;
	}

	FOR(i,1,n)
	 FOR(j,1,n)
	  if(deg[i] > 2){
	            cout << "NO" << '\n';
	            return 0;
	  }

          int ok = 1;
          FOR(i,1,n)
           if(root(i) != root(1) || deg[i] != 2) ok = 0;

          if(ok){
                    cout << "YES" << '\n' << "0" << '\n';
                    return 0;
          }

          while(1){
                    int x = -1, y = -1;
                    FOR(i,1,n){
                              if(deg[i] < 2){
                                        if(x == -1) x = i;
                                        else if(root(i) != root(x) && y == -1) y = i;
                              }
                    }
                    if(x == -1) break;
                    if(y == -1) FOR(i,1,n) if(deg[i] < 2 && i != x) y = i;
                    deg[x]++, deg[y]++;
                    merge(x,y);
                    ans.push_back(pii(x,y));
          }

          FOR(i,1,n)
           if(root(i) != root(1)){
                     cout << "NO" << '\n';
                     return 0;
           }

          cout << "YES" << '\n';
          cout << ans.size() << '\n';
          for(auto i: ans) cout << i.first << " " << i.second << '\n';
          return 0;

}


#include<iostream>
#include<vector>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<cstring>
#include<algorithm>
#include<deque>
#include<unordered_map>
#include<iomanip>

#define mp make_pair
#define ft first
#define sd second
#define pb push_back
#define ll long long
#define ld double
#define lF long double
#define POP pop_back()
#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define FOR(i,a,b) for(int i=(int)a;i<=(int)b;i++)
#define _FOR(i,a,b) for(int i=(int)a;i>=(int)b;i--)
#define mod 1000000007
#define eps 1e-9
#define MEM(x,y) memset(x,y,sizeof(x))

using namespace std;

typedef pair<int,int>pii;

int const N = 55;

int n, m;

int adj[N][N], deg[N];

int par[N], sz[N];
int root(int v){
          if(par[v] == v) return v;
          return root(par[v]);
}
void merge(int x, int y){
          x = root(x), y = root(y);
          if(x == y) return;
          if(sz[y] > sz[x]) swap(x,y);
          par[y] = x;
          sz[x] += sz[y];
}

vector<pii> ans;

int main(){

	cin.sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	cin >> n >> m;

	FOR(i,1,n) par[i] = i, sz[i] = 1;

	FOR(i,1,m){
	          int u, v;
	          cin >> u >> v;
	          adj[u][v]++;
	          adj[v][u]++;
	          deg[u]++;
	          deg[v]++;
	          merge(u,v);
	}

	if(n == 1){
	          if(!m){
	                    cout << "YES\n1\n1 1\n";
	                    return 0;
	          }
	          else if(m == 1 && deg[1] == 2){
	                    cout << "YES\n0\n";
	                    return 0;
	          }
	          else cout << "NO";
	          return 0;
	}

	if(m > n){
	          cout << "NO" << '\n';
	          return 0;
	}

	FOR(i,1,n)
	 FOR(j,1,n)
	  if(deg[i] > 2){
	            cout << "NO" << '\n';
	            return 0;
	  }

          int ok = 1;
          FOR(i,1,n)
           if(root(i) != root(1) || deg[i] != 2) ok = 0;

          if(ok){
                    cout << "YES" << '\n' << "0" << '\n';
                    return 0;
          }

          while(1){
                    int x = -1, y = -1;
                    FOR(i,1,n){
                              if(deg[i] < 2){
                                        if(x == -1) x = i;
                                        else if(root(i) != root(x)) y = i;
                              }
                    }
                    if(x == -1) break;
                    if(y == -1) FOR(i,1,n) if(deg[i] < 2 && i != x) y = i;
                    deg[x]++, deg[y]++;
                    merge(x,y);
                    ans.push_back(pii(x,y));
          }

          FOR(i,1,n)
           if(root(i) != root(1)){
                     cout << "NO" << '\n';
                     return 0;
           }

          cout << "YES" << '\n';
          cout << ans.size() << '\n';
          for(auto i: ans) cout << i.first << " " << i.second << '\n';
          return 0;

}


#include <bits/stdc++.h>
int n, m;
int fa[55], e[55][55];
int deg[55];
std::pair<int, int> ans[55];
int find(int x)
{
    return fa[x] == x ? x : fa[x] = find(fa[x]);
}
int main()
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);
    std::cin >> n >> m;
    if (n < m)
    {
        std::cout << "NO" << '\n';
        return 0;
    }
    for (int i = 1; i <= n; i++)
        fa[i] = i;
    for (int i = 1, a, b; i <= m; i++)
    {
        std::cin >> a >> b;
        e[a][b] = e[b][a] = 1;
        if (++deg[a] > 2 || ++deg[b] > 2)
        {
            std::cout << "NO" << '\n';
            return 0;
        }
        fa[find(a)] = fa[find(b)];
    }
    int num = 0;
    for (int i = 1; i <= n; i++)
        for (int j = i; j <= n; j++)
            if (find(i) != find(j) && deg[i] < 2 && deg[j] < 2)
            {
                ans[++num] = {i, j};
                ++deg[i];
                ++deg[j];
                fa[find(i)] = find(j);
            }
    if (m + num == n - 1)
    {
        num++;
        for (int i = 1; i <= n; i++)
            while (deg[i] < 2)
            {
                deg[i]++;
                if (!ans[num].first)
                    ans[num].first = i;
                else
                    ans[num].second = i;
            }
    }
    for (int i = 1; i <= n; i++)
        if (find(i) != find(1))
        {
            std::cout << "NO" << '\n';
            return 0;
        }
    std::cout << "YES" << '\n'
              << num << '\n';
    for (int i = 1; i <= num; i++)
        std::cout << ans[i].first << " " << ans[i].second << '\n';
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

class DSU {
private:
    vector<int> p;
    int N;
public:

    DSU(int n) {
        N = n;
        p.resize(n + 1);
        for (int i = 1; i <= n; i++) p[i] = i;
    }

    int find(int i) {
        return (p[i] == i ? i : p[i] = find(p[i]));
    }

    int setUnion(int i, int j) {
        if (find(i) != find(j)) {
            N--;
            p[find(i)] = find(j);
        }
    }

    bool isSameSet(int i, int j) {
        return p[find(i)] == p[find(j)];
    }

    int size() {
        return N;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    if (n == 1) {
        puts("YES");
        if (m == 0) puts("1 1");
        else puts("0");
        return 0;
    }
    map<int, int> v;
    DSU dsu(n);
    int x, y;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        dsu.setUnion(x, y);
        v[x]++;
        v[y]++;
    }
    bool fucked = (v.size() ? 0 : 1);
    for (auto x : v) {
        if (x.second > 2) {
            puts("NO");
            return 0;
        }
        if (x.second != 2) fucked = true;
    }
    if (!fucked && dsu.size() == 1) {
        puts("YES\n0");
        return 0;
    }
    if (!fucked) {
        puts("NO");
        return 0;
    }
    printf("YES\n%d\n", n - m);
    for (int c = 0; c < 2; c++)
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= n; j++)
                if (v[i] < 2 && v[j] < 2)
                    if (!dsu.isSameSet(i, j)) {
                        v[i]++, v[j]++;
                        printf("%d %d\n", i, j);
                        dsu.setUnion(i, j);
                    }
    for (int i = 1; i <= n; i++)
        if (v[i] < 2) printf("%d ", i);
    puts("");
}


#include <bits/stdc++.h>

using namespace std;

class DSU {
private:
    vector<int> p;
    int N;
public:

    DSU(int n) {
        N = n;
        p.resize(n + 1);
        for (int i = 1; i <= n; i++) p[i] = i;
    }

    int find(int i) {
        return (p[i] == i ? i : p[i] = find(p[i]));
    }

    int setUnion(int i, int j) {
        if (find(i) != find(j)) {
            N--;
            p[find(i)] = find(j);
        }
    }

    bool isSameSet(int i, int j) {
        return p[find(i)] == p[find(j)];
    }

    int size() {
        return N;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    if (n == 1) {
        puts("YES");
        if (m == 0) puts("1 1");
        return 0;
    }
    map<int, int> v;
    DSU dsu(n);
    int x, y;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        dsu.setUnion(x, y);
        v[x]++;
        v[y]++;
    }
    bool fucked = (v.size() ? 0 : 1);
    for (auto x : v) {
        if (x.second > 2) {
            puts("NO");
            return 0;
        }
        if (x.second != 2) fucked = true;
    }
    if (!fucked && dsu.size() == 1) {
        puts("YES\n0");
        return 0;
    }
    if (!fucked) {
        puts("NO");
        return 0;
    }
    printf("YES\n%d\n", n - m);
    for (int c = 0; c < 2; c++)
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= n; j++)
                if (v[i] < 2 && v[j] < 2)
                    if (!dsu.isSameSet(i, j)) {
                        v[i]++, v[j]++;
                        printf("%d %d\n", i, j);
                        dsu.setUnion(i, j);
                    }
    for (int i = 1; i <= n; i++)
        if (v[i] < 2) printf("%d ", i);
    puts("");
}


#include <bits/stdc++.h>

using namespace std;

class DSU {
private:
    vector<int> p;
    int N;
public:

    DSU(int n) {
        N = n;
        p.resize(n + 1);
        for (int i = 1; i <= n; i++) p[i] = i;
    }

    int find(int i) {
        return (p[i] == i ? i : p[i] = find(p[i]));
    }

    int setUnion(int i, int j) {
        if (find(i) != find(j)) {
            N--;
            p[find(i)] = find(j);
        }
    }

    bool isSameSet(int i, int j) {
        return p[find(i)] == p[find(j)];
    }

    int size() {
        return N;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    map<int, int> v;
    DSU dsu(n);
    int x, y;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        dsu.setUnion(x, y);
        v[x]++;
        v[y]++;
    }
    bool fucked = false;
    for (auto x : v) {
        if (x.second > 2) {
            puts("NO");
            return 0;
        }
        if (x.second != 2) fucked = true;
    }
    if (!fucked && dsu.size() == 1) {
        puts("YES\n0");
        return 0;
    }
    if (dsu.size() == 1) { puts("NO"); return 0; }
    printf("YES\n%d\n", n - m);
    for (int c = 0; c < 2; c++)
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= n; j++)
                if (v[i] < 2 && v[j] < 2)
                    if (!dsu.isSameSet(i, j)) {
                        v[i]++, v[j]++;
                        printf("%d %d\n", i, j);
                        dsu.setUnion(i, j);
                    }
    for (int i = 1; i <= n; i++)
        if (v[i] == 1) printf("%d ", i);
    puts("");
}


#include <bits/stdc++.h>

using namespace std;

class DSU {
private:
    vector<int> p;
    int N;
public:

    DSU(int n) {
        N = n;
        p.resize(n + 1);
        for (int i = 1; i <= n; i++) p[i] = i;
    }

    int find(int i) {
        return (p[i] == i ? i : p[i] = find(p[i]));
    }

    int setUnion(int i, int j) {
        if (find(i) != find(j)) {
            N--;
            p[find(i)] = find(j);
        }
    }

    bool isSameSet(int i, int j) {
        return p[find(i)] == p[find(j)];
    }

    int size() {
        return N;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    if (n == 1) {
        if (m > 1) { puts("NO"); return 0; }
        puts("YES");
        if (m == 0) puts("1 1");
        else puts("0");
        return 0;
    }
    map<int, int> v;
    DSU dsu(n);
    int x, y;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        dsu.setUnion(x, y);
        v[x]++;
        v[y]++;
    }
    bool fucked = (v.size() ? 0 : 1);
    for (auto x : v) {
        if (x.second > 2) {
            puts("NO");
            return 0;
        }
        if (x.second != 2) fucked = true;
    }
    if (!fucked && dsu.size() == 1) {
        puts("YES\n0");
        return 0;
    }
    if (!fucked) {
        puts("NO");
        return 0;
    }
    printf("YES\n%d\n", n - m);
    for (int c = 0; c < 2; c++)
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= n; j++)
                if (v[i] < 2 && v[j] < 2)
                    if (!dsu.isSameSet(i, j)) {
                        v[i]++, v[j]++;
                        printf("%d %d\n", i, j);
                        dsu.setUnion(i, j);
                    }
    for (int i = 1; i <= n; i++)
        if (v[i] < 2) printf("%d ", i);
    puts("");
}


#include <bits/stdc++.h>

using namespace std;

class DSU {
private:
    vector<int> p;
    int N;
public:

    DSU(int n) {
        N = n;
        p.resize(n + 1);
        for (int i = 1; i <= n; i++) p[i] = i;
    }

    int find(int i) {
        return (p[i] == i ? i : p[i] = find(p[i]));
    }

    int setUnion(int i, int j) {
        if (find(i) != find(j)) {
            N--;
            p[find(i)] = find(j);
        }
    }

    bool isSameSet(int i, int j) {
        return p[find(i)] == p[find(j)];
    }

    int size() {
        return N;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    map<int, int> v;
    DSU dsu(n);
    int x, y;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        dsu.setUnion(x, y);
        v[x]++;
        v[y]++;
    }
    bool fucked = false;
    for (auto x : v) {
        if (x.second > 2) {
            puts("NO");
            return 0;
        }
        if (x.second != 2) fucked = true;
    }
    if (!fucked && dsu.size() == 1) {
        puts("YES\n0");
        return 0;
    }
    printf("YES\n%d\n", n - m);
    for (int c = 0; c < 2; c++)
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= n; j++)
                if (v[i] < 2 && v[j] < 2)
                    if (!dsu.isSameSet(i, j)) {
                        v[i]++, v[j]++;
                        printf("%d %d\n", i, j);
                        dsu.setUnion(i, j);
                    }
    for (int i = 1; i <= n; i++)
        if (v[i] == 1) printf("%d ", i);
    puts("");
}


#include <bits/stdc++.h>

using namespace std;

class DSU {
private:
    vector<int> p;
    int N;
public:

    DSU(int n) {
        N = n;
        p.resize(n + 1);
        for (int i = 1; i <= n; i++) p[i] = i;
    }

    int find(int i) {
        return (p[i] == i ? i : p[i] = find(p[i]));
    }

    int setUnion(int i, int j) {
        if (find(i) != find(j)) {
            N--;
            p[find(i)] = find(j);
        }
    }

    bool isSameSet(int i, int j) {
        return p[find(i)] == p[find(j)];
    }

    int size() {
        return N;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    map<int, int> v;
    DSU dsu(n);
    int x, y;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        dsu.setUnion(x, y);
        v[x]++;
        v[y]++;
    }
    bool fucked = (v.size() ? 0 : 1);
    for (auto x : v) {
        if (x.second > 2) {
            puts("NO");
            return 0;
        }
        if (x.second != 2) fucked = true;
    }
    if (!fucked && dsu.size() == 1) {
        puts("YES\n0");
        return 0;
    }
    if (!fucked) {
        puts("NO");
        return 0;
    }
    printf("YES\n%d\n", n - m);
    for (int c = 0; c < 2; c++)
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= n; j++)
                if (v[i] < 2 && v[j] < 2)
                    if (!dsu.isSameSet(i, j)) {
                        v[i]++, v[j]++;
                        printf("%d %d\n", i, j);
                        dsu.setUnion(i, j);
                    }
    for (int i = 1; i <= n; i++)
        if (v[i] == 1) printf("%d ", i);
    puts("");
}


#include <bits/stdc++.h>

using namespace std;

class DSU {
private:
    vector<int> p;
    int N;
public:

    DSU(int n) {
        N = n;
        p.resize(n + 1);
        for (int i = 1; i <= n; i++) p[i] = i;
    }

    int find(int i) {
        return (p[i] == i ? i : p[i] = find(p[i]));
    }

    int setUnion(int i, int j) {
        if (find(i) != find(j)) {
            N--;
            p[find(i)] = find(j);
        }
    }

    bool isSameSet(int i, int j) {
        return p[find(i)] == p[find(j)];
    }

    int size() {
        return N;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    map<int, int> v;
    DSU dsu(n);
    int x, y;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        dsu.setUnion(x, y);
        v[x]++;
        v[y]++;
    }
    bool fucked = false;
    for (auto x : v) {
        if (x.second > 2) {
            puts("NO");
            return 0;
        }
        if (x.second != 2) fucked = true;
    }
    if (!fucked && dsu.size() == 1) {
        puts("YES\n0");
        return 0;
    }
    if (!fucked) {
        puts("NO");
        return 0;
    }
    printf("YES\n%d\n", n - m);
    for (int c = 0; c < 2; c++)
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= n; j++)
                if (v[i] < 2 && v[j] < 2)
                    if (!dsu.isSameSet(i, j)) {
                        v[i]++, v[j]++;
                        printf("%d %d\n", i, j);
                        dsu.setUnion(i, j);
                    }
    for (int i = 1; i <= n; i++)
        if (v[i] == 1) printf("%d ", i);
    puts("");
}


#include <bits/stdc++.h>

using namespace std;

class DSU {
private:
    vector<int> p;
    int N;
public:

    DSU(int n) {
        N = n;
        p.resize(n + 1);
        for (int i = 1; i <= n; i++) p[i] = i;
    }

    int find(int i) {
        return (p[i] == i ? i : p[i] = find(p[i]));
    }

    int setUnion(int i, int j) {
        if (find(i) != find(j)) {
            N--;
            p[find(i)] = find(j);
        }
    }

    bool isSameSet(int i, int j) {
        return p[find(i)] == p[find(j)];
    }

    int size() {
        return N;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    if (n == 1) {
        if (m > 1) { puts("NO"); return 0; }
        puts("YES");
        if (m == 0) puts("1\n1 1");
        else puts("0");
        return 0;
    }
    map<int, int> v;
    DSU dsu(n);
    int x, y;
    for (int i = 0; i < m; i++) {
        cin >> x >> y;
        dsu.setUnion(x, y);
        v[x]++;
        v[y]++;
    }
    bool fucked = (v.size() ? 0 : 1);
    for (auto x : v) {
        if (x.second > 2) {
            puts("NO");
            return 0;
        }
        if (x.second != 2) fucked = true;
    }
    if (!fucked && dsu.size() == 1) {
        puts("YES\n0");
        return 0;
    }
    if (!fucked) {
        puts("NO");
        return 0;
    }
    printf("YES\n%d\n", n - m);
    for (int c = 0; c < 2; c++)
        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= n; j++)
                if (v[i] < 2 && v[j] < 2)
                    if (!dsu.isSameSet(i, j)) {
                        v[i]++, v[j]++;
                        printf("%d %d\n", i, j);
                        dsu.setUnion(i, j);
                    }
    for (int i = 1; i <= n; i++)
        if (v[i] < 2) printf("%d ", i);
    puts("");
}


#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 50 + 5;

struct Edge
{
	int next,to;
}e[MAXN<<1];
int head[MAXN],etot=0, deg[MAXN];
inline void add(int u,int v)
{
	e[++etot] = (Edge){ head[u],v};
	head[u] = etot;
	++deg[v];
}

bool vis[MAXN];
vector<int> ep;
int tot = 0;
void dfs_cnt(int u)
{
	vis[u] = 1; ++tot;
	if(deg[u] == 1) ep.push_back(u);
	for(int i=head[u]; i; i=e[i].next)
	{
		int v = e[i].to;
		if(!vis[v]) dfs_cnt(v);
	}
}

int main(void)
{
	int n,m;
	scanf("%d%d",&n,&m);
	if(m > n) return printf("NO"), 0;
	for(int i=1; i<=m; ++i)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		add(u,v); add(v,u);
	}

	if(n == 1)
	{
		printf("YES\n");
		if(m == 1) printf("0\n");
		else printf("1\n1 1");
		return 0;
	}

	for(int i=1; i<=n; ++i)
		if(deg[i] > 2) return printf("NO"), 0;

	priority_queue<pii,vector<pii>,greater<pii> > q;

	for(int i=1; i<=n; ++i) if(!vis[i])
	{
		ep.clear();
		tot = 0;

		dfs_cnt(i);

		if(tot == 1)
		{
			if(deg[i] != 0) return printf("NO"), 0;
			q.push(make_pair(i,i));
		}
		else
		{
			if(ep.size() != 2) return printf("NO"), 0;
			if(ep[0] > ep[1]) swap(ep[0], ep[1]);
			q.push(make_pair(ep[0], ep[1]));
		}
	}

	printf("YES\n%d\n",n-m);
	while(q.size() > 1)
	{
		pii a = q.top(); q.pop();
		pii b = q.top(); q.pop();
		printf("%d %d\n",a.first,b.first);

		pii nxt = make_pair(a.second, b.second);
		if(nxt.first > nxt.second) swap(nxt.first, nxt.second);

		q.push(nxt);
	}
	pii res = q.top(); q.pop();
	printf("%d %d\n",res.first,res.second);
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 50 + 5;

struct Edge
{
	int next,to;
}e[MAXN<<1];
int head[MAXN],etot=0, deg[MAXN];
inline void add(int u,int v)
{
	e[++etot] = (Edge){ head[u],v};
	head[u] = etot;
	++deg[v];
}

bool vis[MAXN];
vector<int> ep;
int tot = 0;
void dfs_cnt(int u)
{
	vis[u] = 1; ++tot;
	if(deg[u] == 1) ep.push_back(u);
	for(int i=head[u]; i; i=e[i].next)
	{
		int v = e[i].to;
		if(!vis[v]) dfs_cnt(v);
	}
}

int main(void)
{
	int n,m;
	scanf("%d%d",&n,&m);
	if(m > n) return printf("NO"), 0;
	for(int i=1; i<=m; ++i)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		add(u,v); add(v,u);
	}

	for(int i=1; i<=n; ++i)
		if(deg[i] > 2) return printf("NO"), 0;

	priority_queue<pii,vector<pii>,greater<pii> > q;

	for(int i=1; i<=n; ++i) if(!vis[i])
	{
		ep.clear();
		tot = 0;

		dfs_cnt(i);

		if(tot == 1)
		{
			if(deg[i] != 0) return printf("NO"), 0;
			q.push(make_pair(i,i));
		}
		else
		{
			if(ep.size() != 2) return printf("NO"), 0;
			if(ep[0] > ep[1]) swap(ep[0], ep[1]);
			q.push(make_pair(ep[0], ep[1]));
		}
	}

	printf("YES\n%d\n",n-m);
	while(q.size() > 1)
	{
		pii a = q.top(); q.pop();
		pii b = q.top(); q.pop();
		printf("%d %d\n",a.first,b.first);

		pii nxt = make_pair(a.second, b.second);
		if(nxt.first > nxt.second) swap(nxt.first, nxt.second);

		q.push(nxt);
	}
	pii res = q.top(); q.pop();
	printf("%d %d\n",res.first,res.second);
	return 0;
}


#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int MAXN = 50 + 5;

struct Edge
{
	int next,to;
}e[MAXN<<1];
int head[MAXN],etot=0, deg[MAXN];
inline void add(int u,int v)
{
	e[++etot] = (Edge){ head[u],v};
	head[u] = etot;
	++deg[v];
}

bool vis[MAXN];
vector<int> ep;
int tot = 0;
void dfs_cnt(int u)
{
	vis[u] = 1; ++tot;
	if(deg[u] == 1) ep.push_back(u);
	for(int i=head[u]; i; i=e[i].next)
	{
		int v = e[i].to;
		if(!vis[v]) dfs_cnt(v);
	}
}

int main(void)
{
	int n,m;
	scanf("%d%d",&n,&m);
	if(m > n) return printf("NO"), 0;
	for(int i=1; i<=m; ++i)
	{
		int u,v;
		scanf("%d%d",&u,&v);
		add(u,v); add(v,u);
	}

	if(n == m)
	{
		for(int i=1; i<=n; ++i)
			if(deg[i] != 2) return printf("NO"), 0;
		dfs_cnt(1);
		for(int i=1; i<=n; ++i)
			if(!vis[i]) return printf("NO"), 0;
		printf("YES\n0\n");
		return 0;
	}

	for(int i=1; i<=n; ++i)
		if(deg[i] > 2) return printf("NO"), 0;

	priority_queue<pii,vector<pii>,greater<pii> > q;

	for(int i=1; i<=n; ++i) if(!vis[i])
	{
		ep.clear();
		tot = 0;

		dfs_cnt(i);

		if(tot == 1)
		{
			if(deg[i] != 0) return printf("NO"), 0;
			q.push(make_pair(i,i));
		}
		else
		{
			if(ep.size() != 2) return printf("NO"), 0;
			if(ep[0] > ep[1]) swap(ep[0], ep[1]);
			q.push(make_pair(ep[0], ep[1]));
		}
	}

	printf("YES\n%d\n",n-m);
	while(q.size() > 1)
	{
		pii a = q.top(); q.pop();
		pii b = q.top(); q.pop();
		printf("%d %d\n",a.first,b.first);

		pii nxt = make_pair(a.second, b.second);
		if(nxt.first > nxt.second) swap(nxt.first, nxt.second);

		q.push(nxt);
	}

	pii res = q.top(); q.pop();
	if(n == 1 || res.first != res.second)
		printf("%d %d\n",res.first,res.second);
	return 0;
}


#include <bits/stdc++.h>
//Damned if I don't take what I want.

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 70;

int n, m;

bool e[N][N];
pii ans[N]; int ansN;

int p[N], deg[N];

int findpar(int u){ return (u == p[u] ? u : p[u] = findpar(p[u])); }
inline bool join(int u, int v){
	u = findpar(u); v = findpar(v);
	if (u == v) return false;
	p[u] = v; return true;
}

int main(){
	ios::sync_with_stdio( false );
	cout.tie(0); cin.tie(0);

	cin >> n >> m;

	if (n == 1){
		if (m == 1) cout << "YES\n0\n";
		else if (m == 0) cout << "YES\n1\n1 1\n";
		else cout << "NO\n";
		return 0;
	}

	if (n == 2 && m == 2){
		int x, y, z, t; cin >> x >> y >> z >> t;
		if (x != y && z != t) cout << "YES\n0\n";
		else cout << "NO\n";
		return 0;
	}

	for (int i = 0; i < n; i++) p[i] = i;

	for (int i = 0; i < m; i++){
		int u, v; cin >> u >> v; u--; v--;

		if (!join(u, v)){ cout << "NO"; return 0; }
		deg[u]++; deg[v]++;
		e[u][v] = e[v][u] = true;
	}

	for (int i = 0; i < n; i++) if (deg[i] > 2){
		cout << "NO";
		return 0;
	}

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (join(i, j)) ans[ansN++] = pii(i, j), deg[i]++, deg[j]++;

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (deg[i] == 1 && deg[j] == 1)
				ans[ansN++] = pii(i, j);

	cout << "YES\n" << ansN << "\n";
	for (int i = 0; i < ansN; i++)
		cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;

}


#include <bits/stdc++.h>
//Damned if I don't take what I want.

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 70;

int n, m;

bool e[N][N];
pii ans[N]; int ansN;

int p[N], deg[N];

int findpar(int u){ return (u == p[u] ? u : p[u] = findpar(p[u])); }
inline bool join(int u, int v){
	u = findpar(u); v = findpar(v);
	if (u == v) return false;
	p[u] = v; return true;
}

bool vis[N];

bool dfs(int u, int p){
	vis[u] = true;

	bool ok = false;
	for (int i = 0; i < n; i++) if (e[u][i]){
		if (!vis[i]) ok |= dfs(i, u);
		else if (i != p) return true;
	}

	return ok;
}

int main(){
	ios::sync_with_stdio( false );
	cout.tie(0); cin.tie(0);

	cin >> n >> m;

	if (n == 1){
		if (m == 1) cout << "YES\n0\n";
		else if (m == 0) cout << "YES\n1\n1 1\n";
		else cout << "NO\n";
		return 0;
	}

	if (n == 2 && m == 2){
		int x, y, z, t; cin >> x >> y >> z >> t;
		if (x != y && z != t) cout << "YES\n0\n";
		else cout << "NO\n";
		return 0;
	}

	for (int i = 0; i < n; i++) p[i] = i;

	int cnt = 0;
	for (int i = 0; i < m; i++){
		int u, v; cin >> u >> v; u--; v--;

		if (!join(u, v)) cnt++;
		deg[u]++; deg[v]++;
		e[u][v] = e[v][u] = true;
	}

	bool ok = true;
	for (int i = 0; i < n; i++)
		ok &= (deg[i] == 2 && (!i || findpar(i) == findpar(i-1) ) );
	if (ok){
		cout << "YES\n0\n";
		return 0;
	}else if (cnt){
		cout << "NO\n";
		return 0;
	}

	for (int i = 0; i < n; i++) if (deg[i] > 2){
		cout << "NO";
		return 0;
	}

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++){
			//cerr << i << ", " << j << ", " << findpar(i) << ", " << findpar(j) << " " << deg[i] << ", " << deg[j] << endl;
			if (deg[i] < 2 && deg[j] < 2 && join(i,j)) {
				ans[ansN++] = pii(i, j);
				deg[i]++; deg[j]++;
			}
		}

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (deg[i] == 1 && deg[j] == 1)
				ans[ansN++] = pii(i, j);

	cout << "YES\n" << ansN << "\n";
	for (int i = 0; i < ansN; i++)
		cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;

}


#include <bits/stdc++.h>
//Damned if I don't take what I want.

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 70;

int n, m;

bool e[N][N];
pii ans[N]; int ansN;

int p[N], deg[N];

int findpar(int u){ return (u == p[u] ? u : p[u] = findpar(p[u])); }
inline bool join(int u, int v){
	u = findpar(u); v = findpar(v);
	if (u == v) return false;
	p[u] = v; return true;
}

int main(){
	ios::sync_with_stdio( false );
	cout.tie(0); cin.tie(0);

	cin >> n >> m;

	if (n == 1){
		cout << (m == 1 ? "YES\n0\n" : "NO") << endl;
		return 0;
	}

	if (n == 2 && m == 2){
		int x, y, z, t; cin >> x >> y >> z >> t;
		if (x != y && z != t) cout << "YES\n0\n";
		else cout << "NO\n";
		return 0;
	}

	for (int i = 0; i < n; i++) p[i] = i;

	for (int i = 0; i < m; i++){
		int u, v; cin >> u >> v; u--; v--;

		if (!join(u, v)){ cout << "NO"; return 0; }
		deg[u]++; deg[v]++;
		e[u][v] = e[v][u] = true;
	}

	for (int i = 0; i < n; i++) if (deg[i] > 2){
		cout << "NO";
		return 0;
	}

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (join(i, j)) ans[ansN++] = pii(i, j), deg[i]++, deg[j]++;

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (deg[i] == 1 && deg[j] == 1)
				ans[ansN++] = pii(i, j);

	cout << "YES\n" << ansN << "\n";
	for (int i = 0; i < ansN; i++)
		cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;

}


#include <bits/stdc++.h>
//Damned if I don't take what I want.

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 70;

int n, m;

bool e[N][N];
pii ans[N]; int ansN;

int p[N], deg[N];

int findpar(int u){ return (u == p[u] ? u : p[u] = findpar(p[u])); }
inline bool join(int u, int v){
	u = findpar(u); v = findpar(v);
	if (u == v) return false;
	p[u] = v; return true;
}

int main(){
	ios::sync_with_stdio( false );
	cout.tie(0); cin.tie(0);

	cin >> n >> m;

	if (n == 1){
		if (m == 1) cout << "YES\n0\n";
		else if (m == 0) cout << "YES\n1\n1 1\n";
		else cout << "NO\n";
		return 0;
	}

	if (n == 2 && m == 2){
		int x, y, z, t; cin >> x >> y >> z >> t;
		if (x != y && z != t) cout << "YES\n0\n";
		else cout << "NO\n";
		return 0;
	}

	for (int i = 0; i < n; i++) p[i] = i;

	for (int i = 0; i < m; i++){
		int u, v; cin >> u >> v; u--; v--;

		if (!join(u, v)){ cout << "NO"; return 0; }
		deg[u]++; deg[v]++;
		e[u][v] = e[v][u] = true;
	}

	for (int i = 0; i < n; i++) if (deg[i] > 2){
		cout << "NO";
		return 0;
	}

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++){
			//cerr << i << ", " << j << ", " << findpar(i) << ", " << findpar(j) << " " << deg[i] << ", " << deg[j] << endl;
			if (deg[i] < 2 && deg[j] < 2 && join(i,j)) {
				ans[ansN++] = pii(i, j);
				deg[i]++; deg[j]++;
			}
		}

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (deg[i] == 1 && deg[j] == 1)
				ans[ansN++] = pii(i, j);

	cout << "YES\n" << ansN << "\n";
	for (int i = 0; i < ansN; i++)
		cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;

}


#include <bits/stdc++.h>
//Damned if I don't take what I want.

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 70;

int n, m;

bool e[N][N];
pii ans[N]; int ansN;

int p[N], deg[N];

int findpar(int u){ return (u == p[u] ? u : p[u] = findpar(p[u])); }
inline bool join(int u, int v){
	u = findpar(u); v = findpar(v);
	if (u == v) return false;
	p[u] = v; return true;
}

bool vis[N];

bool dfs(int u, int p){
	vis[u] = true;

	bool ok = false;
	for (int i = 0; i < n; i++) if (e[u][i]){
		if (!vis[i]) ok |= dfs(i, u);
		else if (i != p) return true;
	}

	return ok;
}

int main(){
	ios::sync_with_stdio( false );
	cout.tie(0); cin.tie(0);

	cin >> n >> m;

	if (n == 1){
		if (m == 1) cout << "YES\n0\n";
		else if (m == 0) cout << "YES\n1\n1 1\n";
		else cout << "NO\n";
		return 0;
	}

	if (n == 2 && m == 2){
		int x, y, z, t; cin >> x >> y >> z >> t;
		if (x != y && z != t) cout << "YES\n0\n";
		else cout << "NO\n";
		return 0;
	}

	for (int i = 0; i < n; i++) p[i] = i;

	for (int i = 0; i < m; i++){
		int u, v; cin >> u >> v; u--; v--;

		join(u, v);
		deg[u]++; deg[v]++;
		e[u][v] = e[v][u] = true;
	}

	bool ok = true;
	for (int i = 0; i < n; i++)
		ok &= (deg[i] == 2 && (!i || findpar(i) == findpar(i-1) ) );
	if (ok){
		cout << "YES\n0\n";
		return 0;
	}

	for (int i = 0; i < n; i++) if (deg[i] > 2){
		cout << "NO";
		return 0;
	}

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++){
			//cerr << i << ", " << j << ", " << findpar(i) << ", " << findpar(j) << " " << deg[i] << ", " << deg[j] << endl;
			if (deg[i] < 2 && deg[j] < 2 && join(i,j)) {
				ans[ansN++] = pii(i, j);
				deg[i]++; deg[j]++;
			}
		}

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (deg[i] == 1 && deg[j] == 1)
				ans[ansN++] = pii(i, j);

	cout << "YES\n" << ansN << "\n";
	for (int i = 0; i < ansN; i++)
		cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;

}


#include <bits/stdc++.h>
//Damned if I don't take what I want.

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 70;

int n, m;

bool e[N][N];
pii ans[N]; int ansN;

int p[N], deg[N];

int findpar(int u){ return (u == p[u] ? u : p[u] = findpar(p[u])); }
inline bool join(int u, int v){
	u = findpar(u); v = findpar(v);
	if (u == v) return false;
	p[u] = v; return true;
}

int main(){
	ios::sync_with_stdio( false );
	cout.tie(0); cin.tie(0);

	cin >> n >> m;

	if (n == 1){
		cout << (m == 1 ? "YES\n0\n" : "NO") << endl;
		return 0;
	}

	if (n == 2 && m == 2){
		int x, y, z, t; cin >> x >> y >> z >> t;
		if (x != y && z != t) cout << "YES\n";
		else cout << "NO\n";
		return 0;
	}

	for (int i = 0; i < n; i++) p[i] = i;

	for (int i = 0; i < m; i++){
		int u, v; cin >> u >> v; u--; v--;

		if (!join(u, v)){ cout << "NO"; return 0; }
		deg[u]++; deg[v]++;
		e[u][v] = e[v][u] = true;
	}

	for (int i = 0; i < n; i++) if (deg[i] > 2){
		cout << "NO";
		return 0;
	}

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (join(i, j)) ans[ansN++] = pii(i, j), deg[i]++, deg[j]++;

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (deg[i] == 1 && deg[j] == 1)
				ans[ansN++] = pii(i, j);

	cout << "YES\n" << ansN << "\n";
	for (int i = 0; i < ansN; i++)
		cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;

}


#include <bits/stdc++.h>
//Damned if I don't take what I want.

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;

const int N = 70;

int n, m;

bool e[N][N];
pii ans[N]; int ansN;

int p[N], deg[N];

int findpar(int u){ return (u == p[u] ? u : p[u] = findpar(p[u])); }
inline bool join(int u, int v){
	u = findpar(u); v = findpar(v);
	if (u == v) return false;
	p[u] = v; return true;
}

int main(){
	ios::sync_with_stdio( false );
	cout.tie(0); cin.tie(0);

	cin >> n >> m;

	for (int i = 0; i < n; i++) p[i] = i;

	for (int i = 0; i < m; i++){
		int u, v; cin >> u >> v; u--; v--;

		if (!join(u, v)){ cout << "NO"; return 0; }
		deg[u]++; deg[v]++;
		e[u][v] = e[v][u] = true;
	}

	for (int i = 0; i < n; i++) if (deg[i] > 2){
		cout << "NO";
		return 0;
	}

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (join(i, j)) ans[ansN++] = pii(i, j), deg[i]++, deg[j]++;

	for (int i = 0; i < n; i++)
		for (int j = i + 1; j < n; j++)
			if (deg[i] == 1 && deg[j] == 1)
				ans[ansN++] = pii(i, j);

	cout << "YES\n" << ansN << "\n";
	for (int i = 0; i < ansN; i++)
		cout << ans[i].first + 1 << " " << ans[i].second + 1 << endl;

}


#include<bits/stdc++.h>
using namespace std;

template <typename T> void chmin(T &x,const T &y)
{
    if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
    if(x<y)x=y;
}
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define pb push_back
#define mp make_pair
#define gc (c=getchar())
int read()
{
    char c;
    while(gc<'-');
    if(c=='-')
    {
        int x=gc-'0';
        while(gc>='0')x=x*10+c-'0';
        return -x;
    }
    int x=c-'0';
    while(gc>='0')x=x*10+c-'0';
    return x;
}
#undef gc

const int N=50+5;
int fa[N],du[N];
int find(int x)
{
    return fa[x]==x?x:fa[x]=find(fa[x]);
}
pii ans[N];

int main()
{
    freopen("1.in","r",stdin);//freopen("1.out","r",stdin);
    int n=read(),m=read();
    rep(i,1,n)fa[i]=i;
    rep(i,1,m)
    {
        int x=read(),y=read();
        ++du[x];++du[y];
        fa[find(x)]=find(y);
    }
    rep(i,1,n)
    if(du[i]>2)
    {
        puts("NO");
        return 0;
    }
    int top=0;
    rep(i,1,n)
    rep(j,i,n)
    if(find(i)!=find(j)&&du[i]<2&&du[j]<2)
    {
        ans[++top]=mp(i,j);
        ++du[i];++du[j];
        fa[find(i)]=find(j);
    }
    if(m+top==n-1)
    {
        ++top;
        rep(i,1,n)
        while(du[i]<2)
        {
            ++du[i];
            if(!ans[top].first)ans[top].first=i;
            else ans[top].second=i;
        }
    }
    rep(i,1,n)
    if(find(i)!=find(1))
    {
        puts("NO");
        return 0;
    }
    puts("YES");
    printf("%d\n",top);
    rep(i,1,top)printf("%d %d\n",ans[i].first,ans[i].second);
}


//ラブライブ！サンシャイン！
//CF9E
#include<bits/stdc++.h>
using namespace std;
int n,m;
int fa[55],e[55][55];//fa用于判断环，e表示有没有边
int deg[55];//表示度数
pair<int,int> ans[55];//用ans表示连起来的边
int findfather(int x){
	return fa[x]==x?x:fa[x]=findfather(fa[x]);
}
int main(){
	ios::sync_with_stdio(false);//加速
	cin>>n>>m;
	if(n<m){
		cout<<"NO"<<endl;//如果m比n显然不行
		return 0;
	}
	for(int i=1;i<=n;i++) fa[i]=i;

	for(int i=1;i<=m;i++){
		int a,b;
		cin>>a>>b;
		e[a][b]=e[b][a]=1;
		deg[a]++;
		deg[b]++;
		if(deg[a]>2||deg[b]>2){
			cout<<"NO"<<endl;//输入的时候就判断
			return 0;
		}
		fa[findfather(a)]=fa[findfather(b)];
	}
	int num=0;
	for(int i=1;i<=n;i++){
		for(int j=i;j<=n;j++){
			if(findfather(i)!=findfather(j)&&deg[i]<2&&deg[j]<2){
				ans[num++]=make_pair(i,j);
				deg[i]++;
				deg[j]++;
				fa[findfather(i)]=findfather(j);
			}
		}
	}
	if(m+num==n-1){//最后一个点可能没有和第一个点连起来
		num++;
		for(int i=1;i<=n;i++){
			while(deg[i]<2) { //这里要写while 如果只有俩个点 会被hack掉
				deg[i]++;
				if(!ans[num].first) ans[num].first=i;
				else ans[num].second=i;
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(findfather(i)!=findfather(1)){
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl<<num<<endl;
	for(int i=1;i<=num;i++){
		cout<<ans[i].first<<" "<<ans[i].second<<endl;
	}
	return 0;
}


//by kcz 1552920354@qq.com
//if you find any bug in my code
//please tell me
#include<bits/stdc++.h>
using namespace std;

template <typename T> void chmin(T &x,const T &y)
{
    if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
    if(x<y)x=y;
}
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define pb push_back
#define mp make_pair
#define gc (c=getchar())
int read()
{
    char c;
    while(gc<'-');
    if(c=='-')
    {
        int x=gc-'0';
        while(gc>='0')x=x*10+c-'0';
        return -x;
    }
    int x=c-'0';
    while(gc>='0')x=x*10+c-'0';
    return x;
}
#undef gc

const int N=50+5;
int fa[N],du[N];
int find(int x)
{
    return fa[x]==x?x:fa[x]=find(fa[x]);
}
pii ans[N];

int main()
{

    int n=read(),m=read();
    rep(i,1,n)fa[i]=i;
    rep(i,1,m)
    {
        int x=read(),y=read();
        ++du[x];++du[y];
        fa[find(x)]=find(y);
    }
    rep(i,1,n)
    if(du[i]>2)
    {
        puts("NO");
        return 0;
    }
    int top=0;
    rep(i,1,n)
    rep(j,i,n)
    if(find(i)!=find(j)&&du[i]<2&&du[j]<2)
    {
        ans[++top]=mp(i,j);
        ++du[i];++du[j];
        fa[find(i)]=find(j);
    }
    if(m+top==n-1)
    {
        ++top;
        rep(i,1,n)
        while(du[i]<2)
        {
            ++du[i];
            if(!ans[top].first)ans[top].first=i;
            else ans[top].second=i;
        }
    }
    rep(i,1,n)
    if(find(i)!=find(1))
    {
        puts("NO");
        return 0;
    }
    puts("YES");
    printf("%d\n",top);
    rep(i,1,top)printf("%d %d\n",ans[i].first,ans[i].second);
}


//ラブライブ！サンシャイン！
//CF9E
#include<bits/stdc++.h>
using namespace std;
int n,m;
int fa[55],e[55][55];//fa用于判断环，e表示有没有边
int deg[55];//表示度数
pair<int,int> ans[55];//用ans表示连起来的边
int findfather(int x){
	return fa[x]==x?x:fa[x]=findfather(fa[x]);
}
int main(){
	ios::sync_with_stdio(false);//加速
	cin>>n>>m;
	if(n<m){
		cout<<"NO"<<endl;//如果m比n显然不行
		return 0;
	}
	for(int i=1;i<=n;i++) fa[i]=i;

	for(int i=1;i<=m;i++){
		int a,b;
		cin>>a>>b;
		e[a][b]=e[b][a]=1;
		deg[a]++;
		deg[b]++;
		if(deg[a]>2||deg[b]>2){
			cout<<"NO"<<endl;//输入的时候就判断
			return 0;
		}
		fa[findfather(a)]=fa[findfather(b)];
	}
	int num=0;
	for(int i=1;i<=n;i++){
		for(int j=i;j<=n;j++){
			if(findfather(i)!=findfather(j)&&deg[i]<2&&deg[j]<2){
				num++;
				ans[num]=make_pair(i,j);
				deg[i]++;
				deg[j]++;
				fa[findfather(i)]=findfather(j);
			}
		}
	}
	if(m+num==n-1){//最后一个点可能没有和第一个点连起来
		num++;
		for(int i=1;i<=n;i++){
			while(deg[i]<2) { //这里要写while 如果只有俩个点 会被hack掉
				deg[i]++;
				if(!ans[num].first) ans[num].first=i;
				else ans[num].second=i;
			}
		}
	}
	for(int i=1;i<=n;i++){
		if(findfather(i)!=findfather(1)){
			cout<<"NO"<<endl;
			return 0;
		}
	}
	cout<<"YES"<<endl<<num<<endl;
	for(int i=1;i<=num;i++){
		cout<<ans[i].first<<" "<<ans[i].second<<endl;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int main()
{
for(int i=1;i<=1000000000;i++)
for(int j=1;j<=1000000000;j++)
tt=i+j;
}


#include<bits/stdc++.h>
using namespace std;
int n,m;
int fa[55],e[55][55];//fa用于判断环，e表示有没有边
int deg[55];//表示度数
pair<int,int> ans[55];//用ans表示连起来的边，pair储存更方便
int findfather(int x){//找爸爸（雾）
    return fa[x]==x?x:fa[x]=findfather(fa[x]);
}
int main(){
    ios::sync_with_stdio(false);//优化加速
    cin>>n>>m;
    if(n<m){
        cout<<"NO"<<endl;//如果m比n大显然不行
        return 0;
    }
    for(int i=1;i<=n;i++) fa[i]=i;//更新父节点

    for(int i=1;i<=m;i++){
        int a,b;
        cin>>a>>b;
        e[a][b]=e[b][a]=1;
        deg[a]++;
        deg[b]++;
        if(deg[a]>2||deg[b]>2){
            cout<<"NO"<<endl;//输入的时候就判断
                             //如果度超过了2，肯定不能成一个大环
            return 0;
        }
        fa[findfather(a)]=fa[findfather(b)];
    }
    int num=0;
    for(int i=1;i<=n;i++){
        for(int j=i;j<=n;j++){
            if(findfather(i)!=findfather(j)&&deg[i]<2&&deg[j]<2){
                num++;//注意num
                ans[num]=make_pair(i,j);
                deg[i]++;
                deg[j]++;
                fa[findfather(i)]=findfather(j);
            }
        }
    }
    if(m+num==n-1){//最后一个点可能没有和第一个点连起来
        num++;
        for(int i=1;i<=n;i++){
            while(deg[i]<2) { //这里要写while 如果只有俩个点 会被hack掉
                deg[i]++;
                if(!ans[num].first) ans[num].first=i;
                else ans[num].second=i;
            }
        }
    }
    for(int i=1;i<=n;i++){
        if(findfather(i)!=findfather(1)){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl<<num<<endl;
    for(int i=1;i<=num;i++){
        cout<<ans[i].first<<" "<<ans[i].second<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;

template <typename T> void chmin(T &x,const T &y)
{
	if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define pb push_back
#define mp make_pair
#define gc (c=getchar())
int read()
{
    char c;
    while(gc<'-');
    if(c=='-')
    {
        int x=gc-'0';
        while(gc>='0')x=x*10+c-'0';
        return -x;
    }
    int x=c-'0';
    while(gc>='0')x=x*10+c-'0';
    return x;
}
#undef gc

const int N=50+5;
int fa[N],du[N];
int find(int x)
{
	return fa[x]==x?x:fa[x]=find(fa[x]);
}
pii ans[N];

int main()
{
	freopen("1.in","r",stdin);//freopen("1.out","r",stdin);
	int n=read(),m=read();
	rep(i,1,n)fa[i]=i;
	rep(i,1,m)
	{
		int x=read(),y=read();
		++du[x];++du[y];
		fa[find(x)]=find(y);
	}
	rep(i,1,n)
	if(du[i]>2)
	{
		puts("NO");
		return 0;
	}
	int top=0;
	rep(i,1,n)
	rep(j,i,n)
	if(find(i)!=find(j)&&du[i]<2&&du[j]<2)
	{
		ans[++top]=mp(i,j);
		++du[i];++du[j];
		fa[find(i)]=find(j);
	}
	if(m+top==n-1)
	{
		++top;
		rep(i,1,n)
		while(du[i]<2)
		{
			++du[i];
			if(!ans[top].first)ans[top].first=i;
			else ans[top].second=i;
		}
	}
	rep(i,1,n)
	if(find(i)!=find(1))
	{
		puts("NO");
		return 0;
	}
	puts("YES");
	printf("%d\n",top);
	rep(i,1,top)printf("%d %d\n",ans[i].first,ans[i].second);
}


#include<iostream>
#include<cstdio>
using namespace std;
int fa[55],bian[55][2],n,m,tot[55],add[55][2];
int father(int a)
{
	while(a!=fa[a])a=fa[a];
	return a;
}
void dk(int a,int b)
{
	int i=father(a),j,k;
	j=a;
	while(j!=i)
	{
		k=j;
		j=fa[j];
		fa[k]=i;
	}
	i=father(b);
	j=b;
	while(j!=i)
	{
		k=j;
		j=fa[j];
		fa[k]=fa[a];
	}
	fa[i]=fa[a];
	return;
}
int main()
{
	scanf("%d%d",&n,&m);
	if(n==2&&m==0)
	{
		printf("YES\n2\n1 2\n1 2");return 0;
	}
	if(m>n){
		printf("NO");
		return 0;
	}
	int i,j;
	for(i=1;i<=m;i++)
	scanf("%d%d",&bian[i][0],&bian[i][1]);
	for(i=1;i<=n;i++)
	fa[i]=i;
	for(i=1;i<=m;i++)
	{
		tot[bian[i][0]]++;
		tot[bian[i][1]]++;
		if(tot[bian[i][0]]>2||tot[bian[i][1]]>2)
		{
			printf("NO");return 0;
		}
		if(fa[bian[i][0]]==fa[bian[i][1]])
		if(m==n&&i==m)
		{
			printf("YES\n0");
			return 0;
		}
		else
		{
			printf("NO");return 0;
		}
		dk(bian[i][0],bian[i][1]);
	}
	if(n==m){
		printf("YES");return 0;
	}
	for(i=1;i<=n;i++)
	for(j=i+1;j<=n;j++)
	if(father(i)!=father(j))
	{
		if(tot[i]==2||tot[j]==2)continue;
		tot[i]++;tot[j]++;
		add[0][0]++;add[add[0][0]][0]=i;add[add[0][0]][1]=j;
		fa[father(j)]=father(i);
		m++;
	}
	else
	if(m==n-1&&tot[i]==1&&tot[j]==1){
		printf("YES\n%d\n",add[0][0]+1);
		for(int k=1;k<=add[0][0];k++)
		printf("%d %d\n",add[k][0],add[k][1]);
		printf("%d %d",i,j);
		return 0;
	}
	printf("NO");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int M=1e5+5;
struct per {
	int a,b;
	friend bool operator <(per a,per b) {
		if(a.a==b.a) return a.b<b.b;
		return a.a<b.a;
	}
} P[M];
int n,m;
int book[M],flag,cir,cnt;
vector <int> E[M];
int ht[M][5];
int mark[M];
int fa[M];
void dfs(int x,int f) {
	if(E[x].size()>2) flag=1;
	if(book[x]) cir=1;
	book[x]=1;
	fa[x]=cnt;
	if(E[x].size()==1)
		ht[cnt][ht[cnt][3]++]=x;
	for(int i=0; i<E[x].size(); i++) {
		int y=E[x][i];
		if(f==y) continue;
		dfs(y,x);
	}
}
int find(int x) {
	return x==fa[x]?x:fa[x]=find(fa[x]);
}
int num;
int main() {
	scanf("%d%d",&n,&m);
	for(int i=1; i<=m; i++) {
		int a,b;
		scanf("%d%d",&a,&b);
		E[a].push_back(b);
		E[b].push_back(a);
	}
	for(int i=1; i<=n; i++)
		if(!book[i]) {
			cnt++;
			dfs(i,i);
		}
	if(flag) {
		puts("NO");
		return 0;
	}
	if(cnt>1 && cir) {
		puts("NO");
		return 0;
	}
	if(cnt==1 && cir) {
		puts("YES");
		puts("0");
		return 0;
	}
	puts("YES");
	printf("%d\n",cnt);
	for(int i=1; i<=cnt; i++)
		if(ht[i][0]>ht[i][1]) swap(ht[i][0],ht[i][1]);
	for(int i=1; i<=cnt; i++)
		for(int j=i+1; j<=cnt; j++) {
			P[++num]=(per) <%ht[i][0],ht[j][0]%>;
			P[++num]=(per) <%ht[i][0],ht[j][1]%>;
		}
	sort(P+1,P+n+1);
	for(int i=1; i<=num; i++) {
		if(find(fa[P[i].a])!=find(fa[P[i].b])) {
			mark[P[i].a]=1;
			mark[P[i].b]=1;
			fa[find(fa[P[i].a])]=find(fa[P[i].b]);
		}
	}
	int o[5],k=0;
	for(int i=1; i<=cnt; i++) {
		if(!mark[ht[i][0]]) o[++k]=ht[i][0];
		if(!mark[ht[i][1]]) o[++k]=ht[i][1];
	}
	sort(o+1,o+k+1);
	printf("%d %d",o[1],o[2]);
	return 0;
}


#include<cstdio>
int n,m,u,v,de[100],fa[100];
bool flag;
int find(int x)
{
	if(fa[x]^x)	fa[x]=find(fa[x]);
	return fa[x];
}
int main()
{
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;++i)	fa[i]=i;
	for(int i=1;i<=m;++i)
	{
		scanf("%d %d",&u,&v);
		++de[u];
		++de[v];
		int X=find(u),Y=find(v);
		if(X^Y)	fa[X]=Y;
		if(de[u]>2||de[v]>2)	flag=1;
	}
	if(flag)	printf("NO\n");
	else
	{
		printf("YES\n%d\n",n-m);
		for(int i=1;i<=n;++i)
		{
			if(de[i]==1)
			{
				for(int j=i+1;j<=n;++j)
				{
					int X=find(i),Y=find(j);
					if(de[j]<=1&&(X^Y))
					{
						++de[j];
						++de[i];
						fa[X]=Y;
						printf("%d %d\n",i,j);
						break;
					}
				}
			}
			else if(de[i]==0)
			{
				int begin=i;
				for(int j=i+1;j<=n;++j)
				{
					begin=j;
					int X=find(i),Y=find(j);
					if(de[j]<=1&&(X^Y))
					{
						++de[j];
						++de[i];
						fa[X]=Y;
						printf("%d %d\n",i,j);
						break;
					}
				}
				for(int j=begin+1;j<=n;++j)
				{
					int X=find(i),Y=find(j);
					if(de[j]<=1&&(X^Y))
					{
						++de[j];
						++de[i];
						fa[X]=Y;
						printf("%d %d\n",i,j);
						break;
					}
				}
			}
		}
		for(int i=1;i<=n;++i)
		{
			if(de[i]==1)	printf("%d ",i);
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int maxn = 55;
int n, m, fa[maxn], deg[maxn];

int root(int x) { return fa[x] == fa[fa[x]] ? fa[x] : fa[x] = root(fa[x]); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  bool flag = false;
  for (int i = 1; i <= n; ++i)
    fa[i] = i;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    ++deg[a], ++deg[b];
    flag = (root(a) == root(b));
    fa[fa[a]] = fa[b];
  }
  bool ok = m == n;
  for (int i = 1; ok && i <= n; ++i)
    ok = deg[i] == 2;
  for (int i = 2; ok && i <= n; ++i)
    ok = root(i) == root(1);
  if (ok) {
    cout << "YES\n0\n";
    return 0;
  }
  for (int i = 1; !flag && i <= n; ++i)
    flag = deg[i] > 2;
  if (flag || m >= n) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n" << n - m << '\n';
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; deg[i] < 2 && j <= n; ++j)
      if (deg[j] < 2 && root(i) != root(j)) {
        cout << i << ' ' << j << '\n';
        fa[fa[i]] = fa[j];
        ++deg[i], ++deg[j];
      }
  for (int i = 1; i <= n; ++i)
    if (deg[i] < 2) {
      if (n == 1)
        cout << i << ' ' << i;
      else
        cout << i << ' ';
    }
  cout << '\n';
}
//hellobig_tq//hellobig_tq


#include <bits/stdc++.h>
using namespace std;

const int maxn = 55;
int n, m, fa[maxn], deg[maxn];

int root(int x) { return fa[x] == fa[fa[x]] ? fa[x] : fa[x] = root(fa[x]); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  bool flag = false;
  for (int i = 1; i <= n; ++i)
    fa[i] = i;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    ++deg[a], ++deg[b];
    flag = (root(a) == root(b));
    fa[fa[a]] = fa[b];
  }
  bool ok = m == n;
  for (int i = 1; ok && i <= n; ++i)
    ok = deg[i] == 2;
  for (int i = 2; ok && i <= n; ++i)
    ok = root(i) == root(1);
  if (ok) {
    cout << "YES\n0\n";
    return 0;
  }
  for (int i = 1; !flag && i <= n; ++i)
    flag = deg[i] > 2;
  if (flag || m >= n) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n" << n - m << '\n';
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; deg[i] < 2 && j <= n; ++j)
      if (deg[j] < 2 && root(i) != root(j)) {
        cout << i << ' ' << j << '\n';
        fa[fa[i]] = fa[j];
        ++deg[i], ++deg[j];
      }
  for (int i = 1; i <= n; ++i)
    if (deg[i] < 2) {
      if (n == 1)
        cout << i << ' ' << i;
      else
        cout << i << ' ';
    }
  cout << '\n';
}
//hellobig_tq


#include <bits/stdc++.h>
using namespace std;

const int maxn = 55;
int n, m, fa[maxn], deg[maxn];

int root(int x) { return fa[x] == fa[fa[x]] ? fa[x] : fa[x] = root(fa[x]); }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  bool flag = false;
  for (int i = 1; i <= n; ++i)
    fa[i] = i;
  for (int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    ++deg[a], ++deg[b];
    flag = (root(a) == root(b));
    fa[fa[a]] = fa[b];
  }
  bool ok = m == n;
  for (int i = 1; ok && i <= n; ++i)
    ok = deg[i] == 2;
  for (int i = 2; ok && i <= n; ++i)
    ok = root(i) == root(1);
  if (ok) {
    cout << "YES\n0\n";
    return 0;
  }
  for (int i = 1; !flag && i <= n; ++i)
    flag = deg[i] > 2;
  if (flag || m >= n) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n" << n - m << '\n';
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; deg[i] < 2 && j <= n; ++j)
      if (deg[j] < 2 && root(i) != root(j)) {
        cout << i << ' ' << j << '\n';
        fa[fa[i]] = fa[j];
        ++deg[i], ++deg[j];
      }
  for (int i = 1; i <= n; ++i)
    if (deg[i] < 2) {
      if (n == 1)
        cout << i << ' ' << i;
      else
        cout << i << ' ';
    }
  cout << '\n';
}
//hellobig_tq//hellobig_tq//hellobig_tq


#include<bits/stdc++.h>
using namespace std;
int n,m,ji[55];
void dfs(int k)
{
	for(int i=1;i<=n;i++)
	{
		if(i!=k&&ji[i]<2)
		{
			cout<<k<<" "<<i<<endl;
			ji[k]++;ji[i]++;
		}
	}
}
int main()
{
	cin>>n>>m;
	if(n<=m)
	{
		cout<<"NO";return 0;
	}
	int x,y,jiyi=0;
	for(int i=0;i<m;i++)
	{
		scanf("%d%d",&x,&y);
		if(x==y&&n!=1)
		{
			cout<<"NO";return 0;
		}
		ji[x]++;ji[y]++;
		jiyi=jiyi+(ji[x]==1)+(ji[y]==1)-(ji[x]==2)-(ji[y]==2);
		if(ji[x]>=3||ji[y]>=3)
		{
			cout<<"NO";return 0;
		}
	}
	if(jiyi==0&&m!=0)
	{
		cout<<"NO";return 0;
	}
	cout<<"YES"<<endl;
	cout<<n-m<<endl;
	for(int j=1;j<=n-m;j++)
	for(int i=1;i<=n;i++)
	{
		if(ji[i]<2)
		{
			dfs(i);
			break;
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
int n,m,ji[55];
int lu[55];
int find(int k)
{
	if(lu[k]==k)
	return k;
	return lu[k]=find(lu[k]);
}
void dfs(int k)
{
	for(int i=1;i<=n;i++)
	{
		int jik=find(k),jii=find(i);
		if(i!=k&&ji[i]<2&&jik!=jii)
		{
			lu[jii]=jik;
			cout<<k<<" "<<i<<endl;
			ji[k]++;ji[i]++;return;
		}
	}
}
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		lu[i]=i;
	}
	if(n<m)
	{
		cout<<"NO";return 0;
	}
	int x,y,jiyi=0;
	for(int i=0;i<m;i++)
	{
		scanf("%d%d",&x,&y);
		if(find(x)>find(y))
		swap(x,y);
		lu[find(y)]=find(x);
		if(x==y&&n!=1)
		{
			cout<<"NO";return 0;
		}
		ji[x]++;ji[y]++;
		jiyi=jiyi+(ji[x]==1)+(ji[y]==1)-(ji[x]==2)-(ji[y]==2);
		if(ji[x]>=3||ji[y]>=3)
		{
			cout<<"NO";return 0;
		}
	}
	if(jiyi==0&&m!=0&&n!=m)
	{
		cout<<"NO";return 0;
	}
	cout<<"YES"<<endl;
	cout<<n-m<<endl;
	if(n==1&&n-m!=0)
	{
		cout<<1<<" "<<1;return 0;
	}
	for(int j=1;j<=n-m;j++)
	{
		if(j!=n-m)
		for(int i=1;i<=n;i++)
		{
			if(ji[i]<2)
			{
				dfs(i);
				break;
			}
		}
		if(j==n-m)
		{
			for(int i=1;i<=n;i++)
			{
				if(ji[i]<2)
				{
					for(int k=i+1;k<=n;k++)
					{
						if(ji[k]<2)
						{
							cout<<i<<" "<<k;return 0;
						}
					}
				}
			}
		}
	}
}


#include<bits/stdc++.h>
using namespace std;
int n,m,ji[55];
void dfs(int k)
{
	for(int i=1;i<=n;i++)
	{
		if(i!=k&&ji[i]<2)
		{
			cout<<k<<" "<<i<<endl;
			ji[k]++;ji[i]++;
		}
	}
}
int main()
{
	cin>>n>>m;
	if(n<m)
	{
		cout<<"NO";return 0;
	}
	int x,y,jiyi=0;
	for(int i=0;i<m;i++)
	{
		scanf("%d%d",&x,&y);
		if(x==y&&n!=1)
		{
			cout<<"NO";return 0;
		}
		ji[x]++;ji[y]++;
		jiyi=jiyi+(ji[x]==1)+(ji[y]==1)-(ji[x]==2)-(ji[y]==2);
		if(ji[x]>=3||ji[y]>=3)
		{
			cout<<"NO";return 0;
		}
	}
	if(jiyi==0&&m!=0&&n!=m)
	{
		cout<<"NO";return 0;
	}
	cout<<"YES"<<endl;
	cout<<n-m<<endl;
	if(n==1)
	{
		cout<<1<<" "<<1;return 0;
	}
	for(int j=1;j<=n-m;j++)
	for(int i=1;i<=n;i++)
	{
		if(ji[i]<2)
		{
			dfs(i);
			break;
		}
	}
}