#include <iostream>

const int N = 50 + 7, M = 2500 + 7;

int n, m;
int degree[N], root[N], count;

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

int belong(int x, int y) {
	return count <= 1 ? 0 : find_root(x) == find_root(y);
}

int main() {
	scanf_s("%d%d", &n, &m);
	if (m > n) return printf_s("NO"), 0;
	if (n == 1 && m == 0) return printf_s("YES\n1\n1 1"), 0;
	for (int i = 1; i <= n; ++i) root[i] = i;
	count = n;
	for (int i = 1, a, b; i <= m; ++i) {
		scanf_s("%d%d", &a, &b);
		if (degree[a] == 2 || degree[b] == 2) return printf_s("NO"), 0;
		if (belong(a, b)) return printf_s("NO"), 0;
		++degree[a], ++degree[b];
		root[find_root(a)] = find_root(b);
		--count;
	}
	printf_s("YES\n%d\n", n - m);
	for (int i = 1; i <= n; ++i)
		while (degree[i] < 2)
			for (int j = i + 1; j <= n; ++j)
				if (!belong(i, j) && degree[j] < 2) {
					printf_s("%d %d\n", i, j),
						++degree[i], ++degree[j];
					root[find_root(i)] = find_root(j);
					--count;
					break;
				}

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <iterator>
#include <cmath>

using namespace std;

vector<vector<int>> g;
vector<int> dg;
vector<int> colors;
bool cycle = false;

void dfs(int v, int c, int from = 0)
{
    if (colors[v] == 0) {
        colors[v] = c;
        for (auto it = g[v].cbegin(); it != g[v].cend(); ++it)
            if (*it != from)
                dfs(*it, c, v);
    }
    else if (colors[v] == c)
        cycle = true;
}

int main()
{
	if (fopen("input.txt", "r")) {
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	}
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    int n, m;
    cin >> n >> m;
    g.resize(n + 1);
    dg.resize(n + 1);
    colors.resize(n + 1);
    for (int i = 0; i != m; ++i) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
        ++dg[u];
        ++dg[v];
    }
    bool dg2 = true;
    for (int i = 1; i <= n; ++i)
        if (dg[i] != 2) {
            dg2 = false;
            break;
        }
    for (int v = 1; v <= n; ++v)
        dfs(v, v);
    bool connected = true;
    for (int i = 1; i <= n; ++i)
        if (colors[i] != 1) {
            connected = false;
            break;
        }
    if (dg2 && connected) {
        cout << "YES\n0";
        return 0;
    }
    bool flag = false;
    for (int i = 1; i <= n; ++i)
        if (dg[i] > 2) {
            flag = true;
            break;
        }
    if (m >= n || cycle || flag) {
        cout << "NO";
        return 0;
    }
    cout << "YES\n" << n - m;
    int i = 1;
    while (true) {
        bool changed = false;
        while (i <= n && dg[i] == 2)
            ++i;
        if (i > n)
            break;
        for (int j = i + 1; j <= n; ++j)
            if (dg[j] < 2 && colors[i] != colors[j]) {
                changed = true;
                cout << '\n' << i << ' ' << j;
                ++dg[i];
                ++dg[j];
                ++m;
                int c = colors[j];
                for (int k = 1; k <= n; ++k)
                    if (colors[k] == c)
                        colors[k] = colors[i];
                break;
            }
        if (!changed)
            ++i;
    }
    for (i = 1; i <= n; ++i)
        if (dg[i] == 1)
            break;
    int j;
    for (j = n; j >= i; --j)
        if (dg[i] == 1)
            break;
    cout << '\n' << i << ' ' << j;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <iterator>
#include <cmath>

using namespace std;

vector<vector<int>> g;
vector<int> dg;
vector<int> colors;
bool cycle = false;

void dfs(int v, int c, int from = 0)
{
    if (colors[v] == 0) {
        colors[v] = c;
        for (auto it = g[v].cbegin(); it != g[v].cend(); ++it)
            if (*it != from)
                dfs(*it, c, v);
    }
    else if (colors[v] == c)
        cycle = true;
}

int main()
{
	if (fopen("input.txt", "r")) {
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	}
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    int n, m;
    cin >> n >> m;
    g.resize(n + 1);
    dg.resize(n + 1);
    colors.resize(n + 1);
    for (int i = 0; i != m; ++i) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
        ++dg[u];
        ++dg[v];
    }
    bool dg2 = true;
    for (int i = 1; i <= n; ++i)
        if (dg[i] != 2) {
            dg2 = false;
            break;
        }
    for (int v = 1; v <= n; ++v)
        dfs(v, v);
    bool connected = true;
    for (int i = 1; i <= n; ++i)
        if (colors[i] != 1) {
            connected = false;
            break;
        }
    if (dg2 && connected) {
        cout << "YES\n0";
        return 0;
    }
    bool flag = false;
    for (int i = 1; i <= n; ++i)
        if (dg[i] > 2) {
            flag = true;
            break;
        }
    if (m >= n || cycle || flag) {
        cout << "NO";
        return 0;
    }
    cout << "YES\n" << n - m;
    int i = 1;
    while (true) {
        bool changed = false;
        while (i <= n && dg[i] == 2)
            ++i;
        if (i > n)
            break;
        for (int j = i + 1; j <= n; ++j)
            if (dg[j] < 2 && colors[i] != colors[j]) {
                changed = true;
                cout << '\n' << i << ' ' << j;
                ++dg[i];
                ++dg[j];
                ++m;
                int c = colors[j];
                for (int k = 1; k <= n; ++k)
                    if (colors[k] == c)
                        colors[k] = colors[i];
                break;
            }
        if (!changed)
            ++i;
    }
    for (i = 1; i <= n; ++i)
        if (dg[i] < 2)
            break;
    int j;
    for (j = n; j >= i; --j)
        if (dg[i] < 2)
            break;
    cout << '\n' << i << ' ' << j;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <iterator>
#include <cmath>

using namespace std;

vector<vector<int>> g;
vector<int> dg;
vector<int> colors;
bool cycle = false;

void dfs(int v, int c, int from = 0)
{
    if (colors[v] == 0) {
        colors[v] = c;
        for (auto it = g[v].cbegin(); it != g[v].cend(); ++it)
            if (*it != from)
                dfs(*it, c, v);
    }
    else if (colors[v] == c)
        cycle = true;
}

int main()
{
	if (fopen("input.txt", "r")) {
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	}
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    int n, m;
    cin >> n >> m;
    g.resize(n + 1);
    dg.resize(n + 1);
    colors.resize(n + 1);
    for (int i = 0; i != m; ++i) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
        ++dg[u];
        ++dg[v];
    }
    bool dg2 = true;
    for (int i = 1; i <= n; ++i)
        if (dg[i] != 2) {
            dg2 = false;
            break;
        }
    for (int v = 1; v <= n; ++v)
        dfs(v, v);
    bool connected = true;
    for (int i = 1; i <= n; ++i)
        if (colors[i] != 1) {
            connected = false;
            break;
        }
    if (dg2 && connected) {
        cout << "YES\n0";
        return 0;
    }
    bool flag = false;
    for (int i = 1; i <= n; ++i)
        if (dg[i] > 2) {
            flag = true;
            break;
        }
    if (m >= n || cycle || flag) {
        cout << "NO";
        return 0;
    }
    cout << "YES\n" << n - m;
    int i = 1;
    while (true) {
        bool changed = false;
        while (i <= n && dg[i] == 2)
            ++i;
        if (i > n)
            break;
        for (int j = i + 1; j <= n; ++j)
            if (dg[j] < 2 && colors[i] != colors[j]) {
                changed = true;
                cout << '\n' << i << ' ' << j;
                ++dg[i];
                ++dg[j];
                ++m;
                int c = colors[j];
                for (int k = 1; k <= n; ++k)
                    if (colors[k] == c)
                        colors[k] = colors[i];
                break;
            }
        if (!changed)
            ++i;
    }
    for (i = 1; i <= n; ++i)
        if (dg[i] < 2)
            break;
    int j;
    for (j = n; j >= i; --j)
        if (dg[j] < 2)
            break;
    cout << '\n' << i << ' ' << j;
    return 0;
}


#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

typedef vector < int > vi;
typedef vector < string > vs;
typedef vector < bool > vb;
#define FOR(i,q,w) for (int i=q;i<w; i++)
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;

int n,m;
vector <int> G[50];
int C[50];
bool B[50000];

int P[50];

vector <int> V;

vector < pair<int,int> > R;

void dfs(int v)
{
        B[v] = true;
        V.push_back(v);
        FOR (i,0,G[v].size())
                if (B[G[v][i]]==false)
                        dfs(G[v][i]);
}

vector < pair<int,int> > Res;

bool comp(pair <int,int> i, pair<int,int> j)
{
        if (i.second==-1 && j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.second,i.first);
        if (i.second!=-1 && j.second!=-1)
                return i.first<j.first;
        if (i.second==-1)
                return make_pair(i.first,j.first) < make_pair(j.second,i.first);
        if (j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.first,i.first);
}

int main()
{
        cin >> n >> m;

        FOR (i,0,n)
                P[i] = i;

        int c = n;

        FOR (i,0,m)
        {
                int u,v;
                cin >> u >> v;
                u--;
                v--;

                if (u==v && n > 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                G[u].push_back(v);
                G[v].push_back(u);
                C[u]++;
                C[v]++;

                if (P[u] == P[v] && c != 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                if (P[u] != P[v])
                {
                int h = P[u];

                FOR (i,0,n)
                        if (P[i] == h)
                                P[i] = P[v];
                c--;
                }

        }

        bool ok = true;
        FOR (i,0,n)
                if (C[i] > 2)
                        ok = false;
        if (!ok)
        {
                cout << "NO" << endl;
                return 0;
        }

        int c1 = 0, cc = 0;

        vector <int> U;

        FOR (i,0,n)
                if (C[i]==1)
                {
                        U.push_back(i);
                        c1++;
                }
                else if (C[i]==0) cc++;

        if (c1==2 && cc == 0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                if (U[0] > U[1]) swap(U[0],U[1]);

                cout << U[0]+1 << ' ' << U[1]+1 << endl;
                cin >> n;
                return 0;
        }

        FOR (i,0,n)
                if (B[i]==false && C[i]==1)
                {
                        V.erase(V.begin(), V.end());
                        dfs(i);
                        int u = V[0];
                        int v = V.back();

                        if (u>v) swap(u,v);

                        R.push_back(make_pair(u,v));
                }
                else
                if (B[i]==false && C[i]==0)
                {
                        R.push_back(make_pair(i,-1));
                }

        memset(B,false,sizeof(B));

        vector <pair<int,int> > E;
        bool was = false;

        FOR (i,0,R.size())
                if (R[i].second != -1)
                {
                        vector < pair<int,int> > T;

                        vector < pair<int,int> > H;
                        FOR (j,0,R.size())
                                if (j != i)
                                        H.push_back(R[j]);

                        sort(H.begin(), H.end(), comp);

                        if (!H.empty())
                        {
                                T.push_back(make_pair(R[i].first,H[0].first));
                                T.push_back(make_pair((H.back().second==-1?H.back().first:H.back().second),R[i].second));
                        }

                        FOR (j,0,(int)H.size()-1)
                        {
                                if (H[j].second != -1)
                                {
                                        T.push_back(make_pair(H[j].second,H[j+1].first));
                                }
                                else
                                if (H[j].second==-1)
                                {
                                        T.push_back(make_pair(H[j].first,H[j+1].first));
                                }

                        }

                        FOR (j,0,T.size())
                                if (T[j].first > T[j].second)
                                        swap(T[j].first,T[j].second);

                        sort(T.begin(), T.end());

                        if (T.size()+m == n && was == false || T<E)
                        {
                                was = true;
                                E = T;
                        }

                }

        FOR (k,0,R.size())
        FOR (i,0,R.size())
        if (R[i].second==-1 && R[k].second==-1 && k != i && R[k].first <= R[i].first)
                {
                        vector < pair<int,int> > T;
                        T.push_back(make_pair(R[k].first,R[i].first));

                        vector < pair<int,int> > H;
                        FOR (j,0,R.size())
                                if (j != i && j != k)
                                        H.push_back(R[j]);

                        sort(H.begin(), H.end(), comp);

                        if (!H.empty())
                        {
                                T.push_back(make_pair(R[k].first,H[0].first));
                                T.push_back(make_pair((H.back().second==-1?H.back().first:H.back().second),R[i].first));
                        }

                        FOR (j,0,(int)H.size()-1)
                        {
                                if (H[j].second != -1)
                                {
                                        T.push_back(make_pair(H[j].second,H[j+1].first));
                                }
                                else
                                if (H[j].second==-1)
                                {
                                        T.push_back(make_pair(H[j].first,H[j+1].first));
                                }

                        }

                        FOR (j,0,T.size())
                                if (T[j].first > T[j].second)
                                        swap(T[j].first,T[j].second);

                        if (T.size()==1) T.push_back(T[0]);
                        sort(T.begin(), T.end());

                        if (T.size()+m == n && was == false || T<E)
                        {
                                was = true;
                                E = T;
                        }

                }

        cout << "YES" << endl;
        cout << E.size() << endl;
        FOR (i,0,E.size())
                cout << E[i].first+1  << ' ' << E[i].second+1 << endl;

        return 0;
}


#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

typedef vector < int > vi;
typedef vector < string > vs;
typedef vector < bool > vb;
#define FOR(i,q,w) for (int i=q;i<w; i++)
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;

int n,m;
vector <int> G[50];
int C[50];
bool B[50000];

int P[50];

vector <int> V;

vector < pair<int,int> > R;

void dfs(int v)
{
        B[v] = true;
        V.push_back(v);
        FOR (i,0,G[v].size())
                if (B[G[v][i]]==false)
                        dfs(G[v][i]);
}

vector < pair<int,int> > Res;

bool comp(pair <int,int> i, pair<int,int> j)
{
        if (i.second==-1 && j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.second,i.first);
        if (i.second!=-1 && j.second!=-1)
                return i.first<j.first;
        if (i.second==-1)
                return make_pair(i.first,j.first) < make_pair(j.second,i.first);
        if (j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.first,i.first);
}

int main()
{
        cin >> n >> m;

        FOR (i,0,n)
                P[i] = i;

        int c = n;

        FOR (i,0,m)
        {
                int u,v;
                cin >> u >> v;
                u--;
                v--;

                if (u==v && n > 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                G[u].push_back(v);
                G[v].push_back(u);
                C[u]++;
                C[v]++;

                if (P[u] == P[v] && c != 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                if (P[u] != P[v])
                {
                int h = P[u];

                FOR (i,0,n)
                        if (P[i] == h)
                                P[i] = P[v];
                c--;
                }

        }

        bool ok = true;
        FOR (i,0,n)
                if (C[i] > 2)
                        ok = false;
        if (!ok)
        {
                cout << "NO" << endl;
                return 0;
        }

        int c1 = 0, cc = 0;

        vector <int> U;

        FOR (i,0,n)
                if (C[i]==1)
                {
                        U.push_back(i);
                        c1++;
                }
                else if (C[i]==0) cc++;

        if (c1==2 && cc == 0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                if (U[0] > U[1]) swap(U[0],U[1]);

                cout << U[0]+1 << ' ' << U[1]+1 << endl;
                cin >> n;
                return 0;
        }

        FOR (i,0,n)
                if (B[i]==false && C[i]==1)
                {
                        V.erase(V.begin(), V.end());
                        dfs(i);
                        int u = V[0];
                        int v = V.back();

                        if (u>v) swap(u,v);

                        R.push_back(make_pair(u,v));
                }
                else
                if (B[i]==false && C[i]==0)
                {
                        R.push_back(make_pair(i,-1));
                }

        memset(B,false,sizeof(B));

        vector <pair<int,int> > E;
        bool was = false;

        FOR (i,0,R.size())
                if (R[i].second != -1)
                {
                        vector < pair<int,int> > T;

                        vector < pair<int,int> > H;
                        FOR (j,0,R.size())
                                if (j != i)
                                        H.push_back(R[j]);

                        sort(H.begin(), H.end(), comp);

                        if (!H.empty())
                        {
                                T.push_back(make_pair(R[i].first,H[0].first));
                                T.push_back(make_pair((H.back().second==-1?H.back().first:H.back().second),R[i].second));
                        }

                        FOR (j,0,(int)H.size()-1)
                        {
                                if (H[j].second != -1)
                                {
                                        T.push_back(make_pair(H[j].second,H[j+1].first));
                                }
                                else
                                if (H[j].second==-1)
                                {
                                        T.push_back(make_pair(H[j].first,H[j+1].first));
                                }

                        }

                        FOR (j,0,T.size())
                                if (T[j].first > T[j].second)
                                        swap(T[j].first,T[j].second);

                        sort(T.begin(), T.end());

                        if (T.size()+m == n && was == false || T<E)
                        {
                                was = true;
                                E = T;
                        }

                }

        FOR (k,0,R.size())
        FOR (i,0,R.size())
        if (R[i].second==-1 && R[k].second==-1 && k != i && R[k].first <= R[i].first)
                {
                        vector < pair<int,int> > T;
                        T.push_back(make_pair(R[k].first,R[i].first));

                        vector < pair<int,int> > H;
                        FOR (j,0,R.size())
                                if (j != i && j != k)
                                        H.push_back(R[j]);

                        sort(H.begin(), H.end(), comp);

                        if (!H.empty())
                        {
                                T.push_back(make_pair(R[k].first,H[0].first));
                                T.push_back(make_pair((H.back().second==-1?H.back().first:H.back().second),R[i].first));
                        }

                        FOR (j,0,(int)H.size()-1)
                        {
                                if (H[j].second != -1)
                                {
                                        T.push_back(make_pair(H[j].second,H[j+1].first));
                                }
                                else
                                if (H[j].second==-1)
                                {
                                        T.push_back(make_pair(H[j].first,H[j+1].first));
                                }

                        }

                        FOR (j,0,T.size())
                                if (T[j].first > T[j].second)
                                        swap(T[j].first,T[j].second);

                        if (T.size()==1) T.push_back(T[0]);
                        sort(T.begin(), T.end());

                        if (T.size()+m == n && was == false || T<E)
                        {
                                was = true;
                                E = T;
                        }

                }

        if (n==1 && m==0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                cout << "1 2" << endl;
        }
        else
        {
        cout << "YES" << endl;
        cout << E.size() << endl;
        FOR (i,0,E.size())
                cout << E[i].first+1  << ' ' << E[i].second+1 << endl;
        }

        cin >> n;
        return 0;
}


#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

typedef vector < int > vi;
typedef vector < string > vs;
typedef vector < bool > vb;
#define FOR(i,q,w) for (int i=q;i<w; i++)
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;

int n,m;
vector <int> G[50];
int C[50];
bool B[50000];

int P[50];

vector <int> V;

vector < pair<int,int> > R;

void dfs(int v)
{
        B[v] = true;
        V.push_back(v);
        FOR (i,0,G[v].size())
                if (B[G[v][i]]==false)
                        dfs(G[v][i]);
}

vector < pair<int,int> > Res;

bool comp(pair <int,int> i, pair<int,int> j)
{
        if (i.second==-1 && j.second==-1)
                return i.first < j.first;
        if (i.second!=-1 && j.second!=-1)
                return i<j;
        if (i.second==-1)
        {
                if (i.first < j.first) return true;
                if (i.first > j.first) return false;

                if (j.first < j.second) return true;
                if (j.first > j.second) return false;

                return j.second < i.first;
        }
        if (j.second==-1)
        {
                if (i.first < j.first) return true;
                if (i.first > j.first) return false;

                if (i.second < i.first) return true;
                if (i.second > i.second) return false;

                return j.first < i.second;
        }
}

int main()
{
        cin >> n >> m;

        FOR (i,0,n)
                P[i] = i;

        int c = n;

        FOR (i,0,m)
        {
                int u,v;
                cin >> u >> v;
                u--;
                v--;

                if (u==v && n > 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                G[u].push_back(v);
                G[v].push_back(u);
                C[u]++;
                C[v]++;

                if (P[u] == P[v] && c != 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                if (P[u] != P[v])
                {
                int h = P[u];

                FOR (i,0,n)
                        if (P[i] == h)
                                P[i] = P[v];
                c--;
                }

        }

        bool ok = true;
        FOR (i,0,n)
                if (C[i] > 2)
                        ok = false;
        if (!ok)
        {
                cout << "NO" << endl;
                return 0;
        }

        FOR (i,0,n)
                if (B[i]==false && C[i]==1)
                {
                        V.erase(V.begin(), V.end());
                        dfs(i);
                        int u = V[0];
                        int v = V.back();

                        if (u>v) swap(u,v);

                        R.push_back(make_pair(u,v));
                }
                else
                if (B[i]==false && C[i]==0)
                {
                        R.push_back(make_pair(i,-1));
                }

        sort(R.begin(), R.end(), comp);
        V.erase(V.begin(), V.end());
        memset(B,false,sizeof(B));

        FOR (i,0,R.size())
        {
                if (R[i].first != -1 && R[i].second != -1)
                {
                        V.push_back(R[i].second);
                        V.push_back(R[i].first);

                        B[V.size()-2] = true;
                }
                else
                        if (R[i].first==-1)
                        {
                                V.push_back(R[i].second);
                        }
                        else
                        {
                                V.push_back(R[i].first);
                        }
        }

        FOR (i,0,V.size())
                if (B[i]==false)
                {
                        int next = (i+1) % V.size();
                        Res.push_back(make_pair(V[i]+1,V[next]+1));
                }
        cout << "YES" << endl;

        cout << Res.size() << endl;

        FOR (i,0,Res.size())
        {
                if (Res[i].first > Res[i].second)
                        swap(Res[i].first, Res[i].second);

        }

        sort(Res.begin(), Res.end());

        FOR (i,0,Res.size())
                cout << Res[i].first << ' ' << Res[i].second << endl;

        return 0;
}


#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

typedef vector < int > vi;
typedef vector < string > vs;
typedef vector < bool > vb;
#define FOR(i,q,w) for (int i=q;i<w; i++)
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;

int n,m;
vector <int> G[50];
int C[50];
bool B[50000];

int P[50];

vector <int> V;

vector < pair<int,int> > R;

void dfs(int v)
{
        B[v] = true;
        V.push_back(v);
        FOR (i,0,G[v].size())
                if (B[G[v][i]]==false)
                        dfs(G[v][i]);
}

vector < pair<int,int> > Res;

bool comp(pair <int,int> i, pair<int,int> j)
{
        if (i.second==-1 && j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.second,i.first);
        if (i.second!=-1 && j.second!=-1)
                return i.first<j.first;
        if (i.second==-1)
                return make_pair(i.first,j.first) < make_pair(j.second,i.first);
        if (j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.first,i.first);
}

int main()
{
        cin >> n >> m;

        FOR (i,0,n)
                P[i] = i;

        int c = n;

        FOR (i,0,m)
        {
                int u,v;
                cin >> u >> v;
                u--;
                v--;

                if (u==v && n > 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                G[u].push_back(v);
                G[v].push_back(u);
                C[u]++;
                C[v]++;

                if (P[u] == P[v] && c != 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                if (P[u] != P[v])
                {
                int h = P[u];

                FOR (i,0,n)
                        if (P[i] == h)
                                P[i] = P[v];
                c--;
                }

        }

        bool ok = true;
        FOR (i,0,n)
                if (C[i] > 2)
                        ok = false;
        if (!ok)
        {
                cout << "NO" << endl;
                return 0;
        }

        int c1 = 0, cc = 0;

        vector <int> U;

        FOR (i,0,n)
                if (C[i]==1)
                {
                        U.push_back(i);
                        c1++;
                }
                else if (C[i]==0) cc++;

        if (c1==2 && cc == 0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                if (U[0] > U[1]) swap(U[0],U[1]);

                cout << U[0]+1 << ' ' << U[1]+1 << endl;
                cin >> n;
                return 0;
        }

        FOR (i,0,n)
                if (B[i]==false && C[i]==1)
                {
                        V.erase(V.begin(), V.end());
                        dfs(i);
                        int u = V[0];
                        int v = V.back();

                        if (u>v) swap(u,v);

                        R.push_back(make_pair(u,v));
                }
                else
                if (B[i]==false && C[i]==0)
                {
                        R.push_back(make_pair(i,-1));
                }

        memset(B,false,sizeof(B));

        vector <pair<int,int> > E;
        bool was = false;

        FOR (i,0,R.size())
                if (R[i].second != -1)
                {
                        vector < pair<int,int> > T;

                        vector < pair<int,int> > H;
                        FOR (j,0,R.size())
                                if (j != i)
                                        H.push_back(R[j]);

                        sort(H.begin(), H.end(), comp);

                        if (!H.empty())
                        {
                                T.push_back(make_pair(R[i].first,H[0].first));
                                T.push_back(make_pair((H.back().second==-1?H.back().first:H.back().second),R[i].second));
                        }

                        FOR (j,0,(int)H.size()-1)
                        {
                                if (H[j].second != -1)
                                {
                                        T.push_back(make_pair(H[j].second,H[j+1].first));
                                }
                                else
                                if (H[j].second==-1)
                                {
                                        T.push_back(make_pair(H[j].first,H[j+1].first));
                                }

                        }

                        FOR (j,0,T.size())
                                if (T[j].first > T[j].second)
                                        swap(T[j].first,T[j].second);

                        sort(T.begin(), T.end());

                        if (T.size()+m == n && was == false || T<E)
                        {
                                was = true;
                                E = T;
                        }

                }

        FOR (k,0,R.size())
        FOR (i,0,R.size())
        if (R[i].second==-1 && R[k].second==-1 && k != i && R[k].first <= R[i].first)
                {
                        vector < pair<int,int> > T;
                        T.push_back(make_pair(R[k].first,R[i].first));

                        vector < pair<int,int> > H;
                        FOR (j,0,R.size())
                                if (j != i && j != k)
                                        H.push_back(R[j]);

                        sort(H.begin(), H.end(), comp);

                        if (!H.empty())
                        {
                                T.push_back(make_pair(R[k].first,H[0].first));
                                T.push_back(make_pair((H.back().second==-1?H.back().first:H.back().second),R[i].first));
                        }

                        FOR (j,0,(int)H.size()-1)
                        {
                                if (H[j].second != -1)
                                {
                                        T.push_back(make_pair(H[j].second,H[j+1].first));
                                }
                                else
                                if (H[j].second==-1)
                                {
                                        T.push_back(make_pair(H[j].first,H[j+1].first));
                                }

                        }

                        FOR (j,0,T.size())
                                if (T[j].first > T[j].second)
                                        swap(T[j].first,T[j].second);

                        sort(T.begin(), T.end());

                        if (T.size()+m == n && was == false || T<E)
                        {
                                was = true;
                                E = T;
                        }

                }

        cout << "YES" << endl;
        cout << E.size() << endl;
        FOR (i,0,E.size())
                cout << E[i].first+1  << ' ' << E[i].second+1 << endl;

        return 0;
}


#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

typedef vector < int > vi;
typedef vector < string > vs;
typedef vector < bool > vb;
#define FOR(i,q,w) for (int i=q;i<w; i++)
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;

int n,m;
vector <int> G[50];
int C[50];
bool B[50000];

int P[50];

vector <int> V;

vector < pair<int,int> > R;

void dfs(int v)
{
        B[v] = true;
        V.push_back(v);
        FOR (i,0,G[v].size())
                if (B[G[v][i]]==false)
                        dfs(G[v][i]);
}

vector < pair<int,int> > Res;

bool comp(pair <int,int> i, pair<int,int> j)
{
        if (i.second==-1 && j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.second,i.first);
        if (i.second!=-1 && j.second!=-1)
                return i.first<j.first;
        if (i.second==-1)
                return make_pair(i.first,j.first) < make_pair(j.second,i.first);
        if (j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.first,i.first);
}

int main()
{
        cin >> n >> m;

        FOR (i,0,n)
                P[i] = i;

        int c = n;

        FOR (i,0,m)
        {
                int u,v;
                cin >> u >> v;
                u--;
                v--;

                if (u==v && n > 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                G[u].push_back(v);
                G[v].push_back(u);
                C[u]++;
                C[v]++;

                if (P[u] == P[v] && c != 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                if (P[u] != P[v])
                {
                int h = P[u];

                FOR (i,0,n)
                        if (P[i] == h)
                                P[i] = P[v];
                c--;
                }

        }

        bool ok = true;
        FOR (i,0,n)
                if (C[i] > 2)
                        ok = false;
        if (!ok)
        {
                cout << "NO" << endl;
                return 0;
        }

        FOR (i,0,n)
                if (B[i]==false && C[i]==1)
                {
                        V.erase(V.begin(), V.end());
                        dfs(i);
                        int u = V[0];
                        int v = V.back();

                        if (u>v) swap(u,v);

                        R.push_back(make_pair(u,v));
                }
                else
                if (B[i]==false && C[i]==0)
                {
                        R.push_back(make_pair(i,-1));
                }

        memset(B,false,sizeof(B));

        vector <pair<int,int> > E;
        bool was = false;

        FOR (i,0,R.size())
                if (R[i].second != -1)
                {
                        vector < pair<int,int> > T;

                        vector < pair<int,int> > H;
                        FOR (j,0,R.size())
                                if (j != i)
                                        H.push_back(R[j]);

                        sort(H.begin(), H.end(), comp);

                        if (!H.empty())
                        {
                                T.push_back(make_pair(R[i].first,H[0].first));
                                T.push_back(make_pair((H.back().second==-1?H.back().first:H.back().second),R[i].second));
                        }

                        FOR (j,0,(int)H.size()-1)
                        {
                                if (H[j].second != -1)
                                {
                                        T.push_back(make_pair(H[j].second,H[j+1].first));
                                }
                                else
                                if (H[j].second==-1)
                                {
                                        T.push_back(make_pair(H[j].first,H[j+1].first));
                                }

                        }

                        FOR (j,0,T.size())
                                if (T[j].first > T[j].second)
                                        swap(T[j].first,T[j].second);

                        sort(T.begin(), T.end());

                        if (was == false || T<E)
                        {
                                was = true;
                                E = T;
                        }

                }

        FOR (k,0,R.size())
        FOR (i,0,R.size())
        if (R[i].second==-1 && R[k].second==-1 && k != i && R[k].first <= R[i].first)
                {
                        vector < pair<int,int> > T;
                        T.push_back(make_pair(R[k].first,R[i].first));

                        vector < pair<int,int> > H;
                        FOR (j,0,R.size())
                                if (j != i && j != k)
                                        H.push_back(R[j]);

                        sort(H.begin(), H.end(), comp);

                        if (!H.empty())
                        {
                                T.push_back(make_pair(R[k].first,H[0].first));
                                T.push_back(make_pair((H.back().second==-1?H.back().first:H.back().second),R[i].first));
                        }

                        FOR (j,0,(int)H.size()-1)
                        {
                                if (H[j].second != -1)
                                {
                                        T.push_back(make_pair(H[j].second,H[j+1].first));
                                }
                                else
                                if (H[j].second==-1)
                                {
                                        T.push_back(make_pair(H[j].first,H[j+1].first));
                                }

                        }

                        FOR (j,0,T.size())
                                if (T[j].first > T[j].second)
                                        swap(T[j].first,T[j].second);

                        sort(T.begin(), T.end());

                        if (was == false || T<E)
                        {
                                was = true;
                                E = T;
                        }

                }

        cout << "YES" << endl;
        cout << E.size() << endl;
        FOR (i,0,E.size())
                cout << E[i].first+1  << ' ' << E[i].second+1 << endl;

        return 0;
}


#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

typedef vector < int > vi;
typedef vector < string > vs;
typedef vector < bool > vb;
#define FOR(i,q,w) for (int i=q;i<w; i++)
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;

int n,m;
vector <int> G[50];
int C[50];
bool B[50000];

int P[50];

vector <int> V;

vector < pair<int,int> > R;

void dfs(int v)
{
        B[v] = true;
        V.push_back(v);
        FOR (i,0,G[v].size())
                if (B[G[v][i]]==false)
                        dfs(G[v][i]);
}

vector < pair<int,int> > Res;

bool comp(pair <int,int> i, pair<int,int> j)
{
        if (i.second!=-1 && j.second!=-1)
                return make_pair(i.second,j.first) < make_pair(j.second,i.first);
        if (i.second==-1 && j.second==-1)
                return i.first<j.first;
        if (i.second==-1)
                return make_pair(i.first,j.first) < make_pair(j.second,i.first);
        if (j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.first,i.first);
}

int main()
{
        cin >> n >> m;

        FOR (i,0,n)
                P[i] = i;

        int c = n;

        FOR (i,0,m)
        {
                int u,v;
                cin >> u >> v;
                u--;
                v--;

                if (u==v && n > 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                G[u].push_back(v);
                G[v].push_back(u);
                C[u]++;
                C[v]++;

                if (P[u] == P[v] && c != 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                if (P[u] != P[v])
                {
                int h = P[u];

                FOR (i,0,n)
                        if (P[i] == h)
                                P[i] = P[v];
                c--;
                }

        }

        bool ok = true;
        FOR (i,0,n)
                if (C[i] > 2)
                        ok = false;
        if (!ok)
        {
                cout << "NO" << endl;
                return 0;
        }

        int c1 = 0, cc = 0;

        vector <int> U;

        FOR (i,0,n)
                if (C[i]==1)
                {
                        U.push_back(i);
                        c1++;
                }
                else if (C[i]==0) cc++;

        if (c1==2 && cc == 0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                if (U[0] > U[1]) swap(U[0],U[1]);

                cout << U[0]+1 << ' ' << U[1]+1 << endl;
                cin >> n;
                return 0;
        }

        FOR (i,0,n)
                if (B[i]==false && C[i]==1)
                {
                        V.erase(V.begin(), V.end());
                        dfs(i);
                        int u = V[0];
                        int v = V.back();

                        if (u>v) swap(u,v);

                        R.push_back(make_pair(u,v));
                }
                else
                if (B[i]==false && C[i]==0)
                {
                        R.push_back(make_pair(i,-1));
                }

        memset(B,false,sizeof(B));

        vector <pair<int,int> > E;
        bool was = false;

        FOR (i,0,R.size())
                if (R[i].second != -1)
                {
                        vector < pair<int,int> > T;

                        vector < pair<int,int> > H;
                        FOR (j,0,R.size())
                                if (j != i)
                                        H.push_back(R[j]);

                        sort(H.begin(), H.end(), comp);

                        if (!H.empty())
                        {
                                T.push_back(make_pair(R[i].first,H[0].first));
                                T.push_back(make_pair((H.back().second==-1?H.back().first:H.back().second),R[i].second));
                        }

                        FOR (j,0,(int)H.size()-1)
                        {
                                if (H[j].second != -1)
                                {
                                        T.push_back(make_pair(H[j].second,H[j+1].first));
                                }
                                else
                                if (H[j].second==-1)
                                {
                                        T.push_back(make_pair(H[j].first,H[j+1].first));
                                }

                        }

                        FOR (j,0,T.size())
                                if (T[j].first > T[j].second)
                                        swap(T[j].first,T[j].second);

                        sort(T.begin(), T.end());

                        if (T.size()+m == n && was == false || T<E)
                        {
                                was = true;
                                E = T;
                        }

                }

        FOR (k,0,R.size())
        FOR (i,0,R.size())
        if (R[i].second==-1 && R[k].second==-1 && k != i && R[k].first <= R[i].first)
                {
                        vector < pair<int,int> > T;
                        T.push_back(make_pair(R[k].first,R[i].first));

                        vector < pair<int,int> > H;
                        FOR (j,0,R.size())
                                if (j != i && j != k)
                                        H.push_back(R[j]);

                        sort(H.begin(), H.end(), comp);

                        if (!H.empty())
                        {
                                T.push_back(make_pair(R[k].first,H[0].first));
                                T.push_back(make_pair((H.back().second==-1?H.back().first:H.back().second),R[i].first));
                        }

                        FOR (j,0,(int)H.size()-1)
                        {
                                if (H[j].second != -1)
                                {
                                        T.push_back(make_pair(H[j].second,H[j+1].first));
                                }
                                else
                                if (H[j].second==-1)
                                {
                                        T.push_back(make_pair(H[j].first,H[j+1].first));
                                }

                        }

                        FOR (j,0,T.size())
                                if (T[j].first > T[j].second)
                                        swap(T[j].first,T[j].second);

                        if (T.size()==1) T.push_back(T[0]);
                        sort(T.begin(), T.end());

                        if (T.size()+m == n && was == false || T<E)
                        {
                                was = true;
                                E = T;
                        }

                }

        if (n==1 && m==0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                cout << "1 1" << endl;
        }
        else
        {
        cout << "YES" << endl;
        cout << E.size() << endl;
        FOR (i,0,E.size())
                cout << E[i].first+1  << ' ' << E[i].second+1 << endl;
        }

        return 0;
}


#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

typedef vector < int > vi;
typedef vector < string > vs;
typedef vector < bool > vb;
#define FOR(i,q,w) for (int i=q;i<w; i++)
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;

int n,m;
vector <int> G[50];
int C[50];
bool B[50000];

int P[50];

vector <int> V;

vector < pair<int,int> > R;

void dfs(int v)
{
        B[v] = true;
        V.push_back(v);
        FOR (i,0,G[v].size())
                if (B[G[v][i]]==false)
                        dfs(G[v][i]);
}

vector < pair<int,int> > Res;

bool comp(pair <int,int> i, pair<int,int> j)
{
        if (i.second!=-1 && j.second!=-1)
                return make_pair(i.second,j.first) < make_pair(j.second,i.first);
        if (i.second==-1 && j.second==-1)
                return i.first<j.first;
        if (i.second==-1)
                return make_pair(i.first,j.first) < make_pair(j.second,i.first);
        if (j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.first,i.first);
}

int main()
{
        cin >> n >> m;

        FOR (i,0,n)
                P[i] = i;

        int c = n;

        FOR (i,0,m)
        {
                int u,v;
                cin >> u >> v;
                u--;
                v--;

                if (u==v && n > 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                G[u].push_back(v);
                G[v].push_back(u);
                C[u]++;
                C[v]++;

                if (P[u] == P[v] && c != 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                if (P[u] != P[v])
                {
                int h = P[u];

                FOR (i,0,n)
                        if (P[i] == h)
                                P[i] = P[v];
                c--;
                }

        }

        if (n==1 && m==0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                cout << "1 1" << endl;
                return 0;
        }

        bool ok = true;
        FOR (i,0,n)
                if (C[i] > 2)
                        ok = false;
        if (!ok)
        {
                cout << "NO" << endl;
                return 0;
        }

        int c1 = 0, cc = 0;

        vector <int> U;

        FOR (i,0,n)
                if (C[i]==1)
                {
                        U.push_back(i);
                        c1++;
                }
                else if (C[i]==0) cc++;

        if (c1==2 && cc == 0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                if (U[0] > U[1]) swap(U[0],U[1]);

                cout << U[0]+1 << ' ' << U[1]+1 << endl;
                cin >> n;
                return 0;
        }

        FOR (i,0,n) P[i] = i;

        c = n;

        FOR (i,0,n)
                FOR (j,0,G[i].size())
                {
                        int u = i, v = G[i][j];

                        if (P[u] != P[v])
                        {
                                int t = P[u];

                                FOR (k,0,n)
                                        if (P[k] == t)
                                                P[k] = P[v];

                                c--;
                        }

                }

        vector < pair<int,int> > R;

        FOR (i,0,n-m-1)
        {
                pair<int,int> r;
                r.first = -1;
                FOR (u,0,n)
                        FOR (v,u+1,n)
                        {
                                pair<int,int> p;
                                p.first = u;
                                p.second = v;
                                if ( ((P[u] != P[v])) && (C[u] < 2 && C[v] < 2))
                                {
                                        if (r.first == -1 || p<r)
                                                r = p;
                                }
                        }

                if (r.first==-1)
                {
                        break;
                        return 0;
                }
                C[r.first] ++;
                C[r.second] ++;
                R.push_back(r);
                if (P[r.first] != P[r.second])
                {
                        c--;
                        int t = P[r.first];

                        FOR (j,0,n)
                                if (P[j]==t)
                                        P[j] = P[r.second];
                }
        }

        FOR (i,0,n)
                FOR (j,0,i)
                        if (C[j]<2 && C[i]<2)
                        {
                                R.push_back(make_pair(j,i));
                        }

        cout << "YES" << endl;

        cout << R.size() << endl;

        FOR (i,0,R.size())
                cout << R[i].first+1 << ' ' << R[i].second+1 << endl;

        cin >> n;
        return 0;
}


#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

typedef vector < int > vi;
typedef vector < string > vs;
typedef vector < bool > vb;
#define FOR(i,q,w) for (int i=q;i<w; i++)
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;

int n,m;
vector <int> G[50];
int C[50];
bool B[50000];

vector <int> V;

vector < pair<int,int> > R;

void dfs(int v)
{
        B[v] = true;
        V.push_back(v);
        FOR (i,0,G[v].size())
                if (B[G[v][i]]==false)
                        dfs(G[v][i]);
}

vector < pair<int,int> > Res;

bool comp(pair <int,int> i, pair<int,int> j)
{
        if (i.second==-1 && j.second==-1)
                return i.first < j.first;
        if (i.second!=-1 && j.second!=-1)
                return i<j;
        if (i.second==-1)
        {
                if (i.first < j.first) return true;
                if (i.first > j.first) return false;

                if (j.first < j.second) return true;
                if (j.first > j.second) return false;

                return j.second < i.first;
        }
        if (j.second==-1)
        {
                if (i.first < j.first) return true;
                if (i.first > j.first) return false;

                if (i.second < i.first) return true;
                if (i.second > i.second) return false;

                return j.first < i.second;
        }
}

int main()
{
        cin >> n >> m;
        FOR (i,0,m)
        {
                int u,v;
                cin >> u >> v;
                u--;
                v--;
                G[u].push_back(v);
                G[v].push_back(u);
                C[u]++;
                C[v]++;
        }

        bool ok = true;
        FOR (i,0,n)
                if (C[i] > 2)
                        ok = false;
        if (!ok)
        {
                cout << "NO" << endl;
                return 0;
        }

        FOR (i,0,n)
                if (B[i]==false && C[i]==1)
                {
                        V.erase(V.begin(), V.end());
                        dfs(i);
                        int u = V[0];
                        int v = V.back();

                        if (u>v) swap(u,v);

                        R.push_back(make_pair(u,v));
                }
                else
                if (B[i]==false && C[i]==0)
                {
                        R.push_back(make_pair(i,-1));
                }

        sort(R.begin(), R.end(), comp);
        V.erase(V.begin(), V.end());
        memset(B,false,sizeof(B));

        FOR (i,0,R.size())
        {
                if (R[i].first != -1 && R[i].second != -1)
                {
                        V.push_back(R[i].second);
                        V.push_back(R[i].first);

                        B[V.size()-2] = true;
                }
                else
                        if (R[i].first==-1)
                        {
                                V.push_back(R[i].second);
                        }
                        else
                        {
                                V.push_back(R[i].first);
                        }
        }

        FOR (i,0,V.size())
                if (B[i]==false)
                {
                        int next = (i+1) % V.size();
                        Res.push_back(make_pair(V[i]+1,V[next]+1));
                }
        cout << "YES" << endl;

        cout << Res.size() << endl;

        FOR (i,0,Res.size())
        {
                if (Res[i].first > Res[i].second)
                        swap(Res[i].first, Res[i].second);

        }

        sort(Res.begin(), Res.end());

        FOR (i,0,Res.size())
                cout << Res[i].first << ' ' << Res[i].second << endl;

        return 0;
}


#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

typedef vector < int > vi;
typedef vector < string > vs;
typedef vector < bool > vb;
#define FOR(i,q,w) for (int i=q;i<w; i++)
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;

int n,m;
vector <int> G[50];
int C[50];
bool B[50000];

vector <int> V;

vector < pair<int,int> > R;

void dfs(int v)
{
        B[v] = true;
        V.push_back(v);
        FOR (i,0,G[v].size())
                if (B[G[v][i]]==false)
                        dfs(G[v][i]);
}

vector < pair<int,int> > Res;

bool comp(pair <int,int> i, pair<int,int> j)
{
        if (i.second==-1 && j.second==-1)
                return i.first < j.first;
        if (i.second!=-1 && j.second!=-1)
                return i<j;
        if (i.second==-1)
        {
                if (i.first < j.first) return true;
                if (i.first > j.first) return false;

                if (j.first < j.second) return true;
                if (j.first > j.second) return false;

                return j.second < i.first;
        }
        if (j.second==-1)
        {
                if (i.first < j.first) return true;
                if (i.first > j.first) return false;

                if (i.second < i.first) return true;
                if (i.second > i.second) return false;

                return j.first < i.second;
        }
}

int main()
{
        cin >> n >> m;
        FOR (i,0,m)
        {
                int u,v;
                cin >> u >> v;
                u--;
                v--;

                if (u==v && n > 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                G[u].push_back(v);
                G[v].push_back(u);
                C[u]++;
                C[v]++;
        }

        bool ok = true;
        FOR (i,0,n)
                if (C[i] > 2)
                        ok = false;
        if (!ok)
        {
                cout << "NO" << endl;
                return 0;
        }

        FOR (i,0,n)
                if (B[i]==false && C[i]==1)
                {
                        V.erase(V.begin(), V.end());
                        dfs(i);
                        int u = V[0];
                        int v = V.back();

                        if (u>v) swap(u,v);

                        R.push_back(make_pair(u,v));
                }
                else
                if (B[i]==false && C[i]==0)
                {
                        R.push_back(make_pair(i,-1));
                }

        sort(R.begin(), R.end(), comp);
        V.erase(V.begin(), V.end());
        memset(B,false,sizeof(B));

        FOR (i,0,R.size())
        {
                if (R[i].first != -1 && R[i].second != -1)
                {
                        V.push_back(R[i].second);
                        V.push_back(R[i].first);

                        B[V.size()-2] = true;
                }
                else
                        if (R[i].first==-1)
                        {
                                V.push_back(R[i].second);
                        }
                        else
                        {
                                V.push_back(R[i].first);
                        }
        }

        FOR (i,0,V.size())
                if (B[i]==false)
                {
                        int next = (i+1) % V.size();
                        Res.push_back(make_pair(V[i]+1,V[next]+1));
                }
        cout << "YES" << endl;

        cout << Res.size() << endl;

        FOR (i,0,Res.size())
        {
                if (Res[i].first > Res[i].second)
                        swap(Res[i].first, Res[i].second);

        }

        sort(Res.begin(), Res.end());

        FOR (i,0,Res.size())
                cout << Res[i].first << ' ' << Res[i].second << endl;

        return 0;
}


#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

typedef vector < int > vi;
typedef vector < string > vs;
typedef vector < bool > vb;
#define FOR(i,q,w) for (int i=q;i<w; i++)
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;

int n,m;
vector <int> G[50];
int C[50];
bool B[50000];

int P[50];

vector <int> V;

vector < pair<int,int> > R;

void dfs(int v)
{
        B[v] = true;
        V.push_back(v);
        FOR (i,0,G[v].size())
                if (B[G[v][i]]==false)
                        dfs(G[v][i]);
}

vector < pair<int,int> > Res;

bool comp(pair <int,int> i, pair<int,int> j)
{
        if (i.second!=-1 && j.second!=-1)
                return make_pair(i.second,j.first) < make_pair(j.second,i.first);
        if (i.second==-1 && j.second==-1)
                return i.first<j.first;
        if (i.second==-1)
                return make_pair(i.first,j.first) < make_pair(j.second,i.first);
        if (j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.first,i.first);
}

int main()
{
        cin >> n >> m;

        FOR (i,0,n)
                P[i] = i;

        int c = n;

        FOR (i,0,m)
        {
                int u,v;
                cin >> u >> v;
                u--;
                v--;

                if (u==v && n > 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                G[u].push_back(v);
                G[v].push_back(u);
                C[u]++;
                C[v]++;

                if (P[u] == P[v] && c != 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                if (P[u] != P[v])
                {
                int h = P[u];

                FOR (i,0,n)
                        if (P[i] == h)
                                P[i] = P[v];
                c--;
                }

        }

        if (n==1 && m==0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                cout << "1 1" << endl;
                return 0;
        }

        bool ok = true;
        FOR (i,0,n)
                if (C[i] > 2)
                        ok = false;
        if (!ok)
        {
                cout << "NO" << endl;
                return 0;
        }

        int c1 = 0, cc = 0;

        vector <int> U;

        FOR (i,0,n)
                if (C[i]==1)
                {
                        U.push_back(i);
                        c1++;
                }
                else if (C[i]==0) cc++;

        if (c1==2 && cc == 0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                if (U[0] > U[1]) swap(U[0],U[1]);

                cout << U[0]+1 << ' ' << U[1]+1 << endl;
                cin >> n;
                return 0;
        }

        FOR (i,0,n) P[i] = i;

        c = n;

        FOR (i,0,n)
                FOR (j,0,G[i].size())
                {
                        int u = i, v = G[i][j];

                        if (P[i] != P[j])
                        {
                                int t = P[i];

                                FOR (k,0,n)
                                        if (P[k] == t)
                                                P[k] = P[j];

                                c--;
                        }

                }

        vector < pair<int,int> > R;

        FOR (i,0,n-m)
        {
                pair<int,int> r;
                r.first = -1;
                FOR (u,0,n)
                        FOR (v,u+1,n)
                        {
                                pair<int,int> p;
                                p.first = u;
                                p.second = v;
                                if ( ((P[u] != P[v] && c > 1) || (c==1 && P[u]==P[v])) && (C[u] < 2 && C[v] < 2))
                                {
                                        if (r.first == -1 || p<r)
                                                r = p;
                                }
                        }

                if (r.first==-1)
                {
                        cout << "NO" << endl;
                        return 0;
                }
                C[r.first] ++;
                C[r.second] ++;
                R.push_back(r);
                if (P[r.first] != P[r.second])
                {
                        c--;
                        int t = P[r.first];

                        FOR (j,0,n)
                                if (P[j]==t)
                                        P[j] = P[r.second];
                }
        }

        cout << "YES" << endl;

        cout << R.size() << endl;

        FOR (i,0,R.size())
                cout << R[i].first+1 << ' ' << R[i].second+1 << endl;

        return 0;
}


#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

typedef vector < int > vi;
typedef vector < string > vs;
typedef vector < bool > vb;
#define FOR(i,q,w) for (int i=q;i<w; i++)
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;

int n,m;
vector <int> G[50];
int C[50];
bool B[50000];

int P[50];

vector <int> V;

vector < pair<int,int> > R;

void dfs(int v)
{
        B[v] = true;
        V.push_back(v);
        FOR (i,0,G[v].size())
                if (B[G[v][i]]==false)
                        dfs(G[v][i]);
}

vector < pair<int,int> > Res;

bool comp(pair <int,int> i, pair<int,int> j)
{
        if (i.second!=-1 && j.second!=-1)
                return make_pair(i.second,j.first) < make_pair(j.second,i.first);
        if (i.second==-1 && j.second==-1)
                return i.first<j.first;
        if (i.second==-1)
                return make_pair(i.first,j.first) < make_pair(j.second,i.first);
        if (j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.first,i.first);
}

int main()
{
        cin >> n >> m;

        FOR (i,0,n)
                P[i] = i;

        int c = n;

        FOR (i,0,m)
        {
                int u,v;
                cin >> u >> v;
                u--;
                v--;

                if (u==v && n > 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                G[u].push_back(v);
                G[v].push_back(u);
                C[u]++;
                C[v]++;

                if (P[u] == P[v] && c != 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                if (P[u] != P[v])
                {
                int h = P[u];

                FOR (i,0,n)
                        if (P[i] == h)
                                P[i] = P[v];
                c--;
                }

        }

        if (n==1 && m==0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                cout << "1 1" << endl;
                return 0;
        }

        bool ok = true;
        FOR (i,0,n)
                if (C[i] > 2)
                        ok = false;
        if (!ok)
        {
                cout << "NO" << endl;
                return 0;
        }

        int c1 = 0, cc = 0;

        vector <int> U;

        FOR (i,0,n)
                if (C[i]==1)
                {
                        U.push_back(i);
                        c1++;
                }
                else if (C[i]==0) cc++;

        if (c1==2 && cc == 0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                if (U[0] > U[1]) swap(U[0],U[1]);

                cout << U[0]+1 << ' ' << U[1]+1 << endl;
                cin >> n;
                return 0;
        }

        FOR (i,0,n) P[i] = i;

        c = n;

        FOR (i,0,n)
                FOR (j,0,G[i].size())
                {
                        int u = i, v = G[i][j];

                        if (P[i] != P[j])
                        {
                                int t = P[i];

                                FOR (k,0,n)
                                        if (P[k] == t)
                                                P[k] = P[j];

                                c--;
                        }

                }

        vector < pair<int,int> > R;

        FOR (i,0,n-m-1)
        {
                pair<int,int> r;
                r.first = -1;
                FOR (u,0,n)
                        FOR (v,u+1,n)
                        {
                                pair<int,int> p;
                                p.first = u;
                                p.second = v;
                                if ( ((P[u] != P[v] && c > 1)) && (C[u] < 2 && C[v] < 2))
                                {
                                        if (r.first == -1 || p<r)
                                                r = p;
                                }
                        }

                if (r.first==-1)
                {
                        cout << "NO" << endl;
                        return 0;
                }
                C[r.first] ++;
                C[r.second] ++;
                R.push_back(r);
                if (P[r.first] != P[r.second])
                {
                        c--;
                        int t = P[r.first];

                        FOR (j,0,n)
                                if (P[j]==t)
                                        P[j] = P[r.second];
                }
        }

        FOR (i,0,n)
                FOR (j,0,i)
                        if (C[j]==1 && C[i]==1)
                                R.push_back(make_pair(j,i));

        cout << "YES" << endl;

        cout << R.size() << endl;

        FOR (i,0,R.size())
                cout << R[i].first+1 << ' ' << R[i].second+1 << endl;

         return 0;
}


#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.h>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <algorithm>
#include <utility>
using namespace std;

typedef vector < int > vi;
typedef vector < string > vs;
typedef vector < bool > vb;
#define FOR(i,q,w) for (int i=q;i<w; i++)
const long long INF = 1000000000;
const int MOD = 1000000007;
typedef long long ll;

int n,m;
vector <int> G[50];
int C[50];
bool B[50000];

int P[50];

vector <int> V;

vector < pair<int,int> > R;

void dfs(int v)
{
        B[v] = true;
        V.push_back(v);
        FOR (i,0,G[v].size())
                if (B[G[v][i]]==false)
                        dfs(G[v][i]);
}

vector < pair<int,int> > Res;

bool comp(pair <int,int> i, pair<int,int> j)
{
        if (i.second==-1 && j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.second,i.first);
        if (i.second!=-1 && j.second!=-1)
                return i.first<j.first;
        if (i.second==-1)
                return make_pair(i.first,j.first) < make_pair(j.second,i.first);
        if (j.second==-1)
                return make_pair(i.second,j.first) < make_pair(j.first,i.first);
}

int main()
{
        cin >> n >> m;

        FOR (i,0,n)
                P[i] = i;

        int c = n;

        FOR (i,0,m)
        {
                int u,v;
                cin >> u >> v;
                u--;
                v--;

                if (u==v && n > 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                G[u].push_back(v);
                G[v].push_back(u);
                C[u]++;
                C[v]++;

                if (P[u] == P[v] && c != 1)
                {
                        cout << "NO" << endl;
                        return 0;
                }

                if (P[u] != P[v])
                {
                int h = P[u];

                FOR (i,0,n)
                        if (P[i] == h)
                                P[i] = P[v];
                c--;
                }

        }

        bool ok = true;
        FOR (i,0,n)
                if (C[i] > 2)
                        ok = false;
        if (!ok)
        {
                cout << "NO" << endl;
                return 0;
        }

        int c1 = 0, cc = 0;

        vector <int> U;

        FOR (i,0,n)
                if (C[i]==1)
                {
                        U.push_back(i);
                        c1++;
                }
                else if (C[i]==0) cc++;

        if (c1==2 && cc == 0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                if (U[0] > U[1]) swap(U[0],U[1]);

                cout << U[0]+1 << ' ' << U[1]+1 << endl;
                cin >> n;
                return 0;
        }

        FOR (i,0,n)
                if (B[i]==false && C[i]==1)
                {
                        V.erase(V.begin(), V.end());
                        dfs(i);
                        int u = V[0];
                        int v = V.back();

                        if (u>v) swap(u,v);

                        R.push_back(make_pair(u,v));
                }
                else
                if (B[i]==false && C[i]==0)
                {
                        R.push_back(make_pair(i,-1));
                }

        memset(B,false,sizeof(B));

        vector <pair<int,int> > E;
        bool was = false;

        FOR (i,0,R.size())
                if (R[i].second != -1)
                {
                        vector < pair<int,int> > T;

                        vector < pair<int,int> > H;
                        FOR (j,0,R.size())
                                if (j != i)
                                        H.push_back(R[j]);

                        sort(H.begin(), H.end(), comp);

                        if (!H.empty())
                        {
                                T.push_back(make_pair(R[i].first,H[0].first));
                                T.push_back(make_pair((H.back().second==-1?H.back().first:H.back().second),R[i].second));
                        }

                        FOR (j,0,(int)H.size()-1)
                        {
                                if (H[j].second != -1)
                                {
                                        T.push_back(make_pair(H[j].second,H[j+1].first));
                                }
                                else
                                if (H[j].second==-1)
                                {
                                        T.push_back(make_pair(H[j].first,H[j+1].first));
                                }

                        }

                        FOR (j,0,T.size())
                                if (T[j].first > T[j].second)
                                        swap(T[j].first,T[j].second);

                        sort(T.begin(), T.end());

                        if (T.size()+m == n && was == false || T<E)
                        {
                                was = true;
                                E = T;
                        }

                }

        FOR (k,0,R.size())
        FOR (i,0,R.size())
        if (R[i].second==-1 && R[k].second==-1 && k != i && R[k].first <= R[i].first)
                {
                        vector < pair<int,int> > T;
                        T.push_back(make_pair(R[k].first,R[i].first));

                        vector < pair<int,int> > H;
                        FOR (j,0,R.size())
                                if (j != i && j != k)
                                        H.push_back(R[j]);

                        sort(H.begin(), H.end(), comp);

                        if (!H.empty())
                        {
                                T.push_back(make_pair(R[k].first,H[0].first));
                                T.push_back(make_pair((H.back().second==-1?H.back().first:H.back().second),R[i].first));
                        }

                        FOR (j,0,(int)H.size()-1)
                        {
                                if (H[j].second != -1)
                                {
                                        T.push_back(make_pair(H[j].second,H[j+1].first));
                                }
                                else
                                if (H[j].second==-1)
                                {
                                        T.push_back(make_pair(H[j].first,H[j+1].first));
                                }

                        }

                        FOR (j,0,T.size())
                                if (T[j].first > T[j].second)
                                        swap(T[j].first,T[j].second);

                        if (T.size()==1) T.push_back(T[0]);
                        sort(T.begin(), T.end());

                        if (T.size()+m == n && was == false || T<E)
                        {
                                was = true;
                                E = T;
                        }

                }

        if (n==1 && m==0)
        {
                cout << "YES" << endl;
                cout << 1 << endl;
                cout << "1 1" << endl;
        }
        else
        {
        cout << "YES" << endl;
        cout << E.size() << endl;
        FOR (i,0,E.size())
                cout << E[i].first+1  << ' ' << E[i].second+1 << endl;
        }

        cin >> n;
        return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<numeric>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<memory>
#include<string>
#include<vector>
#include<cctype>
#include<list>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
using namespace std;

typedef unsigned long long      ui64;
typedef long long               i64;
typedef vector<int>             VI;
typedef vector<string>          VS;
typedef pair<int,int>           PII;
typedef pair<double,double>     PDD;

#define PB                      push_back
#define MP                      make_pair
#define X                       first
#define Y                       second
#define FOR(i, a, b)            for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)           for(int i = (a) - 1; i >= (b); --i)
#define CLEAR(a, b)             memset(a, b, sizeof(a))
#define SZ(a)                   int((a).size())
#define ALL(a)                  (a).begin(), (a).end()
#define RALL(a)                 (a).rbegin(), (a).rend()
#define INF                     (2000000000)

vector<int> used;
vector<VI> g;
bool is;
void dfs(int v){
    used[v] = 2;
    FOR(i,0,SZ(g[v])){
        if(used[ g[v][i] ]==0)
            dfs( g[v][i] );
        else
            if(used[ g[v][i] ]==1)
                is = false;
    }
    used[v] = 1;
}

VI p;
int parent(int x){
    return p[x]==x ? x : p[x] = parent(p[x]);
}

void marge(int a, int b){
    int pa = parent(a);
    int pb = parent(b);
    if(pa!=pb)
        p[pa] = pb;
}

int main()
{
    int n,m; cin >> n >> m;
    p.resize(n);
    FOR(i,0,n)
        p[i] = i;
    used.resize(n,0);
    g.resize(n);
    is = true;
    FOR(i,0,m){
        int a,b; cin >> a >> b;
        a--;b--;
        g[a].PB(b);
        g[b].PB(a);
        marge(a,b);
    }

    dfs(0);
    bool bx = true;
    FOR(i,0,n){
        if(SZ(g[i])!=2 || !used[ i ]){
            bx = false;
            break;
        }
    }

    if(bx){
        cout << "YES\n0\n";
        return 0;
    }

    FOR(i,0,n){
        if(SZ(g[i])>2){
            is = false;
            break;
        }
    }

    if(m>=n)
        is = false;

    if(!is){
        cout << "NO\n";
        return 0;
    }
    VI sz(n);

    FOR(i,0,n)
        sz[i] = SZ( g[i] );

    cout << "YES\n" << n - m << endl;
    bool bxxx = true;
    while(bxxx){
        bxxx = false;
        int f = -1;
        int pf = -1;
        FOR(i,0,n){
            if(f==-1){
                if( sz[i]<2 ){
                    f = i;
                    pf = parent(f);
                }
            }
            else{
                if(parent(i)!=pf){
                    cout << f+1 << " " << i+1 << endl;
                    marge(f,i);
                    bxxx = true;
                    sz[i]++;
                    sz[f]++;
                    break;
                }
            }
        }
    }
    VI res;
    FOR(i,0,n){
        if(sz[i]<2)
            res.PB(i);
    }
    cout <<  res[0]+1 << " " << res[SZ(res)-1]+1 << endl;

    return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<numeric>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<memory>
#include<string>
#include<vector>
#include<cctype>
#include<list>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
using namespace std;

typedef unsigned long long      ui64;
typedef long long               i64;
typedef vector<int>             VI;
typedef vector<string>          VS;
typedef pair<int,int>           PII;
typedef pair<double,double>     PDD;

#define PB                      push_back
#define MP                      make_pair
#define X                       first
#define Y                       second
#define FOR(i, a, b)            for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)           for(int i = (a) - 1; i >= (b); --i)
#define CLEAR(a, b)             memset(a, b, sizeof(a))
#define SZ(a)                   int((a).size())
#define ALL(a)                  (a).begin(), (a).end()
#define RALL(a)                 (a).rbegin(), (a).rend()
#define INF                     (2000000000)

vector<int> used;
vector<VI> g;
bool is;
void dfs(int v){
    used[v] = 2;
    FOR(i,0,SZ(g[v])){
        if(used[ g[v][i] ]==0)
            dfs( g[v][i] );
        else
            if(used[ g[v][i] ]==1)
                is = false;
    }
    used[v] = 1;
}

VI p;
int parent(int x){
    return p[x]==x ? x : p[x] = parent(p[x]);
}

void marge(int a, int b){
    int pa = parent(a);
    int pb = parent(b);
    if(pa!=pb)
        p[pa] = pb;
}

int main()
{
    int n,m; cin >> n >> m;
    p.resize(n);
    FOR(i,0,n)
        p[i] = i;
    used.resize(n,0);
    g.resize(n);
    is = true;
    FOR(i,0,m){
        int a,b; cin >> a >> b;
        a--;b--;
        if(a==b){
            if(a==0 && n==1 && m==1)
                cout << "YES\n0\n";
            else
                cout << "NO\n";
            return 0;
        }
        g[a].PB(b);
        g[b].PB(a);
        marge(a,b);
    }

    dfs(0);
    bool bx = true;
    FOR(i,0,n){
        if(SZ(g[i])!=2 || !used[ i ]){
            bx = false;
            break;
        }
    }

    if(bx){
        cout << "YES\n0\n";
        return 0;
    }

    FOR(i,0,n){
        if(SZ(g[i])>2){
            is = false;
            break;
        }
    }

    FOR(i,0,n){
        if(!used[i])
            dfs(i);
    }

    if(m>=n)
        is = false;

    if(!is){
        cout << "NO\n";
        return 0;
    }
    VI sz(n);

    FOR(i,0,n)
        sz[i] = SZ( g[i] );

    cout << "YES\n" << n - m << endl;
    bool bxxx = true;
    while(bxxx){
        bxxx = false;
        int f = -1;
        int pf = -1;
        FOR(i,0,n){
            if(f==-1){
                if( sz[i]<2 ){
                    f = i;
                    pf = parent(f);
                }
            }
            else{
                if(sz[i]<2 && parent(i)!=pf){
                    cout << f+1 << " " << i+1 << endl;
                    marge(f,i);
                    bxxx = true;
                    sz[i]++;
                    sz[f]++;
                    break;
                }
            }
        }
    }
    VI res;
    FOR(i,0,n){
        if(sz[i]<2)
            res.PB(i);
    }
    cout <<  res[0]+1 << " " << res[SZ(res)-1]+1 << endl;

    return 0;
}


#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<numeric>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<memory>
#include<string>
#include<vector>
#include<cctype>
#include<list>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
using namespace std;

typedef unsigned long long      ui64;
typedef long long               i64;
typedef vector<int>             VI;
typedef vector<string>          VS;
typedef pair<int,int>           PII;
typedef pair<double,double>     PDD;

#define PB                      push_back
#define MP                      make_pair
#define X                       first
#define Y                       second
#define FOR(i, a, b)            for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)           for(int i = (a) - 1; i >= (b); --i)
#define CLEAR(a, b)             memset(a, b, sizeof(a))
#define SZ(a)                   int((a).size())
#define ALL(a)                  (a).begin(), (a).end()
#define RALL(a)                 (a).rbegin(), (a).rend()
#define INF                     (2000000000)

vector<int> used;
vector<VI> g;
bool is;
void dfs(int v){
    used[v] = 2;
    FOR(i,0,SZ(g[v])){
        if(used[ g[v][i] ]==0)
            dfs( g[v][i] );
        else
            if(used[ g[v][i] ]==1)
                is = false;
    }
    used[v] = 1;
}

VI p;
int parent(int x){
    return p[x]==x ? x : p[x] = parent(p[x]);
}

void marge(int a, int b){
    int pa = parent(a);
    int pb = parent(b);
    if(pa!=pb)
        p[pa] = pb;
}

int main()
{
    int n,m; cin >> n >> m;
    p.resize(n);
    FOR(i,0,n)
        p[i] = i;
    used.resize(n,0);
    g.resize(n);
    is = true;
    FOR(i,0,m){
        int a,b; cin >> a >> b;
        a--;b--;
        if(a==b){
            if(a==0 && n==1 && m==1)
                cout << "YES\n0\n";
            else
                cout << "NO\n";
            return 0;
        }
        g[a].PB(b);
        g[b].PB(a);
        marge(a,b);
    }

    dfs(0);
    bool bx = true;
    FOR(i,0,n){
        if(SZ(g[i])!=2 || !used[ i ]){
            bx = false;
            break;
        }
    }

    if(bx){
        cout << "YES\n0\n";
        return 0;
    }

    FOR(i,0,n){
        if(SZ(g[i])>2){
            is = false;
            break;
        }
    }

    FOR(i,0,n){
        if(!used[i])
            dfs(i);
    }

    if(m>=n)
        is = false;

    if(!is){
        cout << "NO\n";
        return 0;
    }
    VI sz(n);

    FOR(i,0,n)
        sz[i] = SZ( g[i] );

    cout << "YES\n" << n - m << endl;
    bool bxxx = true;
    while(bxxx){
        bxxx = false;
        int f = -1;
        int pf = -1;
        FOR(i,0,n){
            if(f==-1){
                if( sz[i]<2 ){
                    f = i;
                    pf = parent(f);
                }
            }
            else{
                if(parent(i)!=pf){
                    cout << f+1 << " " << i+1 << endl;
                    marge(f,i);
                    bxxx = true;
                    sz[i]++;
                    sz[f]++;
                    break;
                }
            }
        }
    }
    VI res;
    FOR(i,0,n){
        if(sz[i]<2)
            res.PB(i);
    }
    cout <<  res[0]+1 << " " << res[SZ(res)-1]+1 << endl;

    return 0;
}


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void york()
{
}

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

	return 0;
}


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void york()
{
}

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

	return 0;
}


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

void york()
{
}

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

	return 0;
}