#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>

using namespace std;

#define ABS(a) ((a>0)?a:-(a))
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a<b)?(b):(a))
#define FOR(i,a,n) for (int i=(a);i<(n);++i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define pnt pair <LL, LL>
#define mp make_pair
#define PI 3.14159265358979
#define MEMS(a,b) memset(a,b,sizeof(a))
#define LL long long
#define U unsigned

int n,m;
vector<vector<int> > g;
vector<int> a,b;
vector<pnt > c;
int was[100100];
void inLine(int st)
{
	int par=-1;
	int v=st;
	FOR(i,0,n)
	{
		a.push_back(v);
		was[v]=1;
		bool f=false;
		FOR(j,0,g[v].size())
			if ((g[v][j]!=par) && (g[v][j]!=st))
			{
				par=v;
				v=g[v][j];
				f=true;
				break;
			}
		if (!f)
			break;
	}
}
void solve1()
{
	if (n<=4)
	{
		cout<<-1<<endl;
		return;
	}
	FOR(i,0,n)
		if (was[c[i].second]==0)
			inLine(c[i].second);
	int cnt=0;
	if (m>=1)
		printf("%d %d\n",a[2]+1,a[4]+1);
	if (m>=2)
	printf("%d %d\n",a[4]+1,a[1]+1);
	if (m>=3)
		printf("%d %d\n",a[1]+1,a[3]+1);
	int last1=a[2];
	int last2=a[3];
	cnt=3;
	FOR(i,5,n)
	{
		if (cnt==m)
			break;
		if (i&1)
		{
			printf("%d %d\n",a[i]+1,last1+1);
			last1=a[i];
		}
		else
		{
			printf("%d %d\n",a[i]+1,last2+1);
			last2=a[i];
		}
		cnt++;
	}
	if (cnt<m)
	{
		printf("%d %d\n",a[0]+1,last1+1);
		cnt++;
	}
	if (cnt<m)
		printf("%d %d\n",a[0]+1,last2+1);
}
void solve2()
{
	if (n<=3)
	{
		cout<<-1<<endl;
		return;
	}
	FOR(i,0,n)
		if (was[c[i].second]==0)
			inLine(c[i].second);
	printf("%d %d\n",a[1]+1,a[3]+1);
	printf("%d %d\n",a[3]+1,a[0]+1);
	printf("%d %d\n",a[0]+1,a[2]+1);
	int last1=a[1];
	int last2=a[2];
	FOR(i,4,n)
	{
		if (i&1)
		{
			printf("%d %d\n",a[i]+1,last1+1);
			last1=a[i];
		}
		else
		{
			printf("%d %d\n",a[i]+1,last2+1);
			last2=a[i];
		}
	}
}
inline int in(int v1, int v2)
{
	FOR(j,0,g[v1].size())
		if (g[v1][j]==v2)
			return true;
	return false;
}
void solve3()
{
	if (m==0)
		return;
	int cnt=0;
	int last1=0,last2=-1;
	FOR(i,1,n)
	{
		if (!in(i,0))
		{
			last2=i;
			break;
		}
	}
	if (last2==-1)
	{
		cout<<-1<<endl;
		return;
	}
	FOR(i,0,n)
		if ((i!=last1) && (i!=last2))
			a.push_back(i);
	printf("%d %d\n",last1+1,last2+1);
	cnt=1;
	while (cnt<m)
	{
		bool good=false;
		while (a.size())
		{
			int v=a[a.size()-1];
			a.pop_back();
			if (!in(v,last1))
			{
				printf("%d %d\n",last1+1,v+1);
				last1=v;
				cnt++;
				good=true;
				break;
			}
			else
				if (!in(v,last2))
				{
					printf("%d %d\n",last1+2,v+1);
					last2=v;
					cnt++;
					good=true;
					break;
				}
				else
				{
					b.push_back(v);
				}
		}
		if (!good)
			break;
		while (b.size())
		{
			a.push_back(b[b.size()-1]);
			b.pop_back();
		}
	}
	if (cnt==m)
		return;
	printf("%d %d\n",a[0]+1,a[1]+1);
}
int main()
{
#ifdef Fcdkbear
	freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	double beg=clock();
#endif

	scanf("%d%d",&n,&m);
	g.resize(n);
	FOR(i,0,m)
	{
		int v1,v2;
		scanf("%d%d",&v1,&v2);
		v1--;
		v2--;
		g[v1].push_back(v2);
		g[v2].push_back(v1);
	}
	FOR(i,0,n)
		c.push_back(mp(g[i].size(),i));
	sort(c.begin(),c.end());
	if ((n>=5) || (n==m))
		solve1();
	else
		if (m==n-1)
			solve2();
		else
			solve3();
#ifdef Fcdkbear
	double end=clock();
	fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
#endif
	return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>

using namespace std;

#define ABS(a) ((a>0)?a:-(a))
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a<b)?(b):(a))
#define FOR(i,a,n) for (int i=(a);i<(n);++i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define pnt pair <LL, LL>
#define mp make_pair
#define PI 3.14159265358979
#define MEMS(a,b) memset(a,b,sizeof(a))
#define LL long long
#define U unsigned

int n,m;
vector<vector<int> > g;
vector<int> a,b;

inline int in(int v1, int v2)
{
	FOR(j,0,g[v1].size())
		if (g[v1][j]==v2)
			return true;
	return false;
}

int main()
{
#ifdef Fcdkbear
	freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
#endif

	double beg=clock();
	scanf("%d%d",&n,&m);
	g.resize(n);
	FOR(i,0,m)
	{
		int v1,v2;
		scanf("%d%d",&v1,&v2);
		v1--;
		v2--;
		g[v1].push_back(v2);
		g[v2].push_back(v1);
	}
	FOR(i,0,n)
		a.push_back(i);
	while (1)
	{
		double end=clock();
		if (end-beg>=2.85*CLOCKS_PER_SEC)
		{
			cout<<-1<<endl;
			break;
		}
		random_shuffle(a.begin(),a.end());
		a.push_back(a[0]);
		int cnt=0;
		FOR(i,0,a.size()-1)
		{
			if (cnt==m)
				break;
			if (!in(a[i],a[i+1]))
				cnt++;
		}
		if (cnt==m)
		{
			cnt=0;
			FOR(i,0,a.size()-1)
			{
				if (cnt==m)
					break;
				if (!in(a[i],a[i+1]))
				{
					printf("%d %d\n",a[i]+1,a[i+1]+1);
					cnt++;
				}
			}
			break;
		}
		a.pop_back();
	}
#ifdef Fcdkbear
	double end=clock();
	fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
#endif
	return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>

using namespace std;

#define ABS(a) ((a>0)?a:-(a))
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a<b)?(b):(a))
#define FOR(i,a,n) for (int i=(a);i<(n);++i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define pnt pair <LL, LL>
#define mp make_pair
#define PI 3.14159265358979
#define MEMS(a,b) memset(a,b,sizeof(a))
#define LL long long
#define U unsigned

int n,m;
vector<vector<int> > g;
vector<int> a,b;
vector<pnt > c;
int was[100100];
void inLine(int st)
{
	int par=-1;
	int v=st;
	FOR(i,0,n)
	{
		a.push_back(v);
		was[v]=1;
		bool f=false;
		FOR(j,0,g[v].size())
			if ((g[v][j]!=par) && (g[v][j]!=st))
			{
				par=v;
				v=g[v][j];
				f=true;
				break;
			}
		if (!f)
			break;
	}
}
inline int in(int v1, int v2)
{
	FOR(j,0,g[v1].size())
		if (g[v1][j]==v2)
			return true;
	return false;
}
vector<pnt > d,e;
void solve1()
{
	if (n<=4)
	{
		cout<<-1<<endl;
		return;
	}
	FOR(i,0,n)
		if (was[c[i].second]==0)
			inLine(c[i].second);
	d.push_back(mp(a[0],a[2]));
	d.push_back(mp(a[2],a[4]));
	d.push_back(mp(a[4],a[1]));
	d.push_back(mp(a[1],a[3]));
	d.push_back(mp(a[3],a[0]));
	FOR(i,5,n)
	{
		int v=a[i];
		while (d.size())
		{
			pnt k=d[d.size()-1];
			d.pop_back();
			if ((!in(v,k.first)) && (!in(v,k.second)))
			{
				d.push_back(mp(v,k.first));
				d.push_back(mp(v,k.second));
				break;
			}
			else
				e.push_back(k);
		}
		while (e.size())
		{
			d.push_back(e[e.size()-1]);
			e.pop_back();
		}
	}
	FOR(i,0,d.size())
	{
		int v1=d[i].first;
		int v2=d[i].second;
		printf("%d %d\n",v1+1,v2+1);
	}
}

void solve2()
{
	if (n<=3)
	{
		cout<<-1<<endl;
		return;
	}
	FOR(i,0,n)
		if (was[c[i].second]==0)
			inLine(c[i].second);
	printf("%d %d\n",a[1]+1,a[3]+1);
	printf("%d %d\n",a[3]+1,a[0]+1);
	printf("%d %d\n",a[0]+1,a[2]+1);
	int last1=a[1];
	int last2=a[2];
	FOR(i,4,n)
	{
		if (i&1)
		{
			printf("%d %d\n",a[i]+1,last1+1);
			last1=a[i];
		}
		else
		{
			printf("%d %d\n",a[i]+1,last2+1);
			last2=a[i];
		}
	}
}

void solve3()
{
	if (m==0)
		return;
	int cnt=0;
	int last1=0,last2=-1;
	FOR(i,1,n)
	{
		if (!in(i,0))
		{
			last2=i;
			break;
		}
	}
	if (last2==-1)
	{
		cout<<-1<<endl;
		return;
	}
	FOR(i,0,n)
		if ((i!=last1) && (i!=last2))
			a.push_back(i);
	printf("%d %d\n",last1+1,last2+1);
	cnt=1;
	while (cnt<m)
	{
		bool good=false;
		while (a.size())
		{
			int v=a[a.size()-1];
			a.pop_back();
			if (!in(v,last1))
			{
				printf("%d %d\n",last1+1,v+1);
				last1=v;
				cnt++;
				good=true;
				break;
			}
			else
				if (!in(v,last2))
				{
					printf("%d %d\n",last2+1,v+1);
					last2=v;
					cnt++;
					good=true;
					break;
				}
				else
				{
					b.push_back(v);
				}
		}
		if (!good)
			break;
		while (b.size())
		{
			a.push_back(b[b.size()-1]);
			b.pop_back();
		}
	}
	if (cnt==m)
		return;
	printf("%d %d\n",a[0]+1,a[1]+1);
}
int main()
{
#ifdef Fcdkbear
	freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	double beg=clock();
#endif

	scanf("%d%d",&n,&m);
	g.resize(n);
	FOR(i,0,m)
	{
		int v1,v2;
		scanf("%d%d",&v1,&v2);
		v1--;
		v2--;
		g[v1].push_back(v2);
		g[v2].push_back(v1);
	}
	FOR(i,0,n)
		c.push_back(mp(g[i].size(),i));
	sort(c.begin(),c.end());
	if ((n==m))
		solve1();
	else
		if (m==n-1)
			solve2();
		else
			solve3();
#ifdef Fcdkbear
	double end=clock();
	fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
#endif
	return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>

using namespace std;

#define ABS(a) ((a>0)?a:-(a))
#define MIN(a,b) ((a<b)?(a):(b))
#define MAX(a,b) ((a<b)?(b):(a))
#define FOR(i,a,n) for (int i=(a);i<(n);++i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define pnt pair <LL, LL>
#define mp make_pair
#define PI 3.14159265358979
#define MEMS(a,b) memset(a,b,sizeof(a))
#define LL long long
#define U unsigned

int n,m;
vector<vector<int> > g;
vector<int> a,b;
vector<pnt > c;
int was[100100];
void inLine(int st)
{
	int par=-1;
	int v=st;
	FOR(i,0,n)
	{
		a.push_back(v);
		was[v]=1;
		bool f=false;
		FOR(j,0,g[v].size())
			if ((g[v][j]!=par) && (g[v][j]!=st))
			{
				par=v;
				v=g[v][j];
				f=true;
				break;
			}
		if (!f)
			break;
	}
}
void solve1()
{
	if (n<=4)
	{
		cout<<-1<<endl;
		return;
	}
	FOR(i,0,n)
		if (was[c[i].second]==0)
			inLine(c[i].second);
	int cnt=0;
	if (m>=1)
		printf("%d %d\n",a[2]+1,a[4]+1);
	if (m>=2)
	printf("%d %d\n",a[4]+1,a[1]+1);
	if (m>=3)
		printf("%d %d\n",a[1]+1,a[3]+1);
	int last1=a[2];
	int last2=a[3];
	cnt=3;
	FOR(i,5,n)
	{
		if (cnt==m)
			break;
		if (i&1)
		{
			printf("%d %d\n",a[i]+1,last1+1);
			last1=a[i];
		}
		else
		{
			printf("%d %d\n",a[i]+1,last2+1);
			last2=a[i];
		}
		cnt++;
	}
	if (cnt<m)
	{
		printf("%d %d\n",a[0]+1,last1+1);
		cnt++;
	}
	if (cnt<m)
		printf("%d %d\n",a[0]+1,last2+1);
}
void solve2()
{
	if (n<=3)
	{
		cout<<-1<<endl;
		return;
	}
	FOR(i,0,n)
		if (was[c[i].second]==0)
			inLine(c[i].second);
	printf("%d %d\n",a[1]+1,a[3]+1);
	printf("%d %d\n",a[3]+1,a[0]+1);
	printf("%d %d\n",a[0]+1,a[2]+1);
	int last1=a[1];
	int last2=a[2];
	FOR(i,4,n)
	{
		if (i&1)
		{
			printf("%d %d\n",a[i]+1,last1+1);
			last1=a[i];
		}
		else
		{
			printf("%d %d\n",a[i]+1,last2+1);
			last2=a[i];
		}
	}
}
inline int in(int v1, int v2)
{
	FOR(j,0,g[v1].size())
		if (g[v1][j]==v2)
			return true;
	return false;
}
void solve3()
{
	if (m==0)
		return;
	int cnt=0;
	int last1=0,last2=-1;
	FOR(i,1,n)
	{
		if (!in(i,0))
		{
			last2=i;
			break;
		}
	}
	if (last2==-1)
	{
		cout<<-1<<endl;
		return;
	}
	FOR(i,0,n)
		if ((i!=last1) && (i!=last2))
			a.push_back(i);
	printf("%d %d\n",last1+1,last2+1);
	cnt=1;
	while (cnt<m)
	{
		bool good=false;
		while (a.size())
		{
			int v=a[a.size()-1];
			a.pop_back();
			if (!in(v,last1))
			{
				printf("%d %d\n",last1+1,v+1);
				last1=v;
				cnt++;
				good=true;
				break;
			}
			else
				if (!in(v,last2))
				{
					printf("%d %d\n",last1+2,v+1);
					last2=v;
					cnt++;
					good=true;
					break;
				}
				else
				{
					b.push_back(v);
				}
		}
		if (!good)
			break;
		while (b.size())
		{
			a.push_back(b[b.size()-1]);
			b.pop_back();
		}
	}
	if (cnt==m)
		return;
	printf("%d %d\n",a[0]+1,a[1]+1);
}
int main()
{
#ifdef Fcdkbear
	freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	double beg=clock();
#endif

	scanf("%d%d",&n,&m);
	g.resize(n);
	FOR(i,0,m)
	{
		int v1,v2;
		scanf("%d%d",&v1,&v2);
		v1--;
		v2--;
		g[v1].push_back(v2);
		g[v2].push_back(v1);
	}
	FOR(i,0,n)
		c.push_back(mp(g[i].size(),i));
	sort(c.begin(),c.end());
	if ((n==m))
		solve1();
	else
		if (m==n-1)
			solve2();
		else
			solve3();
#ifdef Fcdkbear
	double end=clock();
	fprintf(stderr,"*** Total time = %.3lf ***\n",(end-beg)/CLOCKS_PER_SEC);
#endif
	return 0;
}


//#define OSW

#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <set>

using namespace std;

int x1[100005];
int x2[100005];
int flag[100005];

int main() {
    #ifdef OSW
    freopen("C:\\Users\\Osw\\Desktop\\in.txt","r",stdin);
    #endif // OSW
    ios::sync_with_stdio(0);

    int a;
    int n,m;
    cin >> n >> m;
    fill(x1+1, x1+1+n, -1);
    fill(x2+1, x2+1+n, -1);
    fill(flag+1, flag+1+n, 0);
    for (int i=0; i!=m; ++i) {
        int a,b;
        cin >> a >> b;
        if (-1 == x1[a])    x1[a] = b;
        else                x2[a] = b;
        if (-1 == x1[b])    x1[b] = a;
        else                x2[b] = a;
    }

    set<int> l1;
    for (int i=2; i!=n+1; ++i) l1.insert(i);

    list<int> l2;
    l2.push_back(1);

    set<int> l3;
    if (l1.count(x1[1])) { l3.insert(x1[1]); l1.erase(x1[1]); }
    if (l1.count(x2[1])) { l3.insert(x2[1]); l1.erase(x2[1]); }

    for (int i=0; i!=m; ++i) {
        //for (list<int>::iterator it = l2.begin(); it!=l2.end(); ++it) cout << *it << ' ';cout << endl;
        bool f = 0;

        int a = l2.back();
        set<int>::iterator it3 = l3.begin();
        for (int n=0; n!=3; ++n) {
            if (it3==l3.end()) break;
            if (x1[a]==*it3 || x2[a]==*it3) ++it3;
            else {
                l2.push_back(*it3);
                if (l1.count(x1[*it3])) { l3.insert(x1[*it3]); l1.erase(x1[*it3]); }
                if (l1.count(x2[*it3])) { l3.insert(x2[*it3]); l1.erase(x2[*it3]); }
                l3.erase(it3);
                //int t = *it3; l3.erase(t); l1.erase(t);
                f = 1;
                break;
            }
        }
        if (f) continue;

        set<int>::iterator it1 = l1.begin();
        for (int n=0; n!=3; ++n) {
            if (it1==l1.end()) break;
            if (x1[a]==*it1 || x2[a]==*it1) ++it1;
            else {
                l2.push_back(*it1);
                if (l1.count(x1[*it1])) { l3.insert(x1[*it1]); l1.erase(x1[*it1]); }
                if (l1.count(x2[*it1])) { l3.insert(x2[*it1]); l1.erase(x2[*it1]); }
                l1.erase(it1);
                //int t = *it1; l3.erase(t); l1.erase(t);
                f = 1;
                break;
            }
        }
        if (f) continue;

        a = l2.front();
        it3 = l3.begin();
        for (int n=0; n!=3; ++n) {
            if (it3==l3.end()) break;
            if (x1[a]==*it3 || x2[a]==*it3) ++it3;
            else {
                l2.push_front(*it3);
                if (l1.count(x1[*it3])) { l3.insert(x1[*it3]); l1.erase(x1[*it3]); }
                if (l1.count(x2[*it3])) { l3.insert(x2[*it3]); l1.erase(x2[*it3]); }
                l3.erase(it3);
                //int t = *it3; l3.erase(t); l1.erase(t);
                f = 1;
                break;
            }
        }
        if (f) continue;
        it1 = l1.begin();
        for (int n=0; n!=3; ++n) {
            if (it1==l1.end()) break;
            if (x1[a]==*it1 || x2[a]==*it1) ++it1;
            else {
                l2.push_front(*it1);
                if (l1.count(x1[*it1])) { l3.insert(x1[*it1]); l1.erase(x1[*it1]); }
                if (l1.count(x2[*it1])) { l3.insert(x2[*it1]); l1.erase(x2[*it1]); }
                l1.erase(it1);
                //int t = *it1; l3.erase(t); l1.erase(t);
                f = 1;
                break;
            }
        }
        if (f) continue;

        if (!f) {
            cout << "-1" << endl;
            return 0;
        }

    }
    list<int>::iterator it1 = l2.begin();
    for (int i=0; i!=m; ++i) {
        list<int>::iterator it2 = it1;
        ++it2;
        cout << *it1 << ' ' << *it2 << endl;
        ++it1;
    }

}


//#define OSW

#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>

using namespace std;

int x1[100005];
int x2[100005];
int flag[100005];

int main() {
    #ifdef OSW
    freopen("C:\\Users\\Osw\\Desktop\\in.txt","r",stdin);
    #endif // OSW
    ios::sync_with_stdio(0);

    int a;
    int n,m;
    cin >> n >> m;
    fill(x1+1, x1+1+n, -1);
    fill(x2+1, x2+1+n, -1);
    fill(flag+1, flag+1+n, 0);
    for (int i=0; i!=m; ++i) {
        int a,b;
        cin >> a >> b;
        if (-1 == x1[a])    x1[a] = b;
        else                x2[a] = b;
        if (-1 == x1[b])    x1[b] = a;
        else                x2[b] = a;
    }

    list<int> l1;
    for (int i=2; i!=n+1; ++i) l1.push_back(i);

    list<int> l2;
    l2.push_back(1);

    for (int i=0; i!=m; ++i) {
        bool f = 0;
        int a = l2.back();
        list<int>::iterator it = l1.begin();
        for (int n=0; n!=3; ++n) {
            if (it==l1.end()) break;
            if (x1[a]==*it || x2[a]==*it) ++it;
            else {
                l2.push_back(*it);
                l1.erase(it);
                f = 1;
                break;
            }
        }
        if (f) continue;

        a = l2.front();
        it = l1.begin();
        for (int n=0; n!=3; ++n) {
            if (it==l1.end()) break;
            if (x1[a]==*it || x2[a]==*it) ++it;
            else {
                l2.push_front(*it);
                l1.erase(it);
                f = 1;
                break;
            }
        }
        if (!f) {
            cout << "-1" << endl;
            return 0;
        }

    }
    list<int>::iterator it1 = l2.begin();
    for (int i=0; i!=m; ++i) {
        list<int>::iterator it2 = it1;
        ++it2;
        cout << *it1 << ' ' << *it2 << endl;
        ++it1;
    }

}


//#define OSW

#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>
#include <set>

using namespace std;

int x1[100005];
int x2[100005];
int flag[100005];

int main() {
    #ifdef OSW
    freopen("C:\\Users\\Osw\\Desktop\\in.txt","r",stdin);
    #endif // OSW
    ios::sync_with_stdio(0);

    int a;
    int n,m;
    cin >> n >> m;
    fill(x1+1, x1+1+n, -1);
    fill(x2+1, x2+1+n, -1);
    fill(flag+1, flag+1+n, 0);
    for (int i=0; i!=m; ++i) {
        int a,b;
        cin >> a >> b;
        if (-1 == x1[a])    x1[a] = b;
        else                x2[a] = b;
        if (-1 == x1[b])    x1[b] = a;
        else                x2[b] = a;
    }

    set<int> l1;
    for (int i=2; i!=n+1; ++i) l1.insert(i);

    list<int> l2;
    l2.push_back(1);

    set<int> l3;
    if (-1 != x1[1]) { l3.insert(x1[1]); l1.erase(x1[1]); }
    if (-1 != x2[1]) { l3.insert(x2[1]); l1.erase(x2[1]); }

    for (int i=0; i!=m; ++i) {
        bool f = 0;
        int a = l2.back();
        set<int>::iterator it3 = l3.begin();
        for (int n=0; n!=3; ++n) {
            if (it3==l3.end()) break;
            if (x1[a]==*it3 || x2[a]==*it3) ++it3;
            else {
                l2.push_back(*it3);
                if (-1 != x1[*it3]) { l3.insert(x1[*it3]); l1.erase(x1[*it3]); }
                if (-1 != x2[*it3]) { l3.insert(x2[*it3]); l1.erase(x2[*it3]); }
                //l3.erase(it3);
                int t = *it3; l3.erase(t); l1.erase(t);
                f = 1;
                break;
            }
        }
        if (f) continue;

        set<int>::iterator it1 = l1.begin();
        for (int n=0; n!=3; ++n) {
            if (it1==l1.end()) break;
            if (x1[a]==*it1 || x2[a]==*it1) ++it1;
            else {
                l2.push_back(*it1);
                if (-1 != x1[*it1]) { l3.insert(x1[*it1]); l1.erase(x1[*it1]); }
                if (-1 != x2[*it1]) { l3.insert(x2[*it1]); l1.erase(x2[*it1]); }
                //l1.erase(it1);
                int t = *it1; l3.erase(t); l1.erase(t);
                f = 1;
                break;
            }
        }
        if (f) continue;

        a = l2.front();
        it3 = l3.begin();
        for (int n=0; n!=3; ++n) {
            if (it3==l3.end()) break;
            if (x1[a]==*it3 || x2[a]==*it3) ++it3;
            else {
                l2.push_back(*it3);
                if (-1 != x1[*it3]) { l3.insert(x1[*it3]); l1.erase(x1[*it3]); }
                if (-1 != x2[*it3]) { l3.insert(x2[*it3]); l1.erase(x2[*it3]); }
                //l3.erase(it3);
                int t = *it3; l3.erase(t); l1.erase(t);
                f = 1;
                break;
            }
        }
        if (f) continue;
        it1 = l1.begin();
        for (int n=0; n!=3; ++n) {
            if (it1==l1.end()) break;
            if (x1[a]==*it1 || x2[a]==*it1) ++it1;
            else {
                l2.push_back(*it1);
                if (-1 != x1[*it1]) { l3.insert(x1[*it1]); l1.erase(x1[*it1]); }
                if (-1 != x2[*it1]) { l3.insert(x2[*it1]); l1.erase(x2[*it1]); }
                //l1.erase(it1);
                int t = *it1; l3.erase(t); l1.erase(t);
                f = 1;
                break;
            }
        }
        if (f) continue;

        if (!f) {
            cout << "-1" << endl;
            return 0;
        }

    }
    list<int>::iterator it1 = l2.begin();
    for (int i=0; i!=m; ++i) {
        list<int>::iterator it2 = it1;
        ++it2;
        cout << *it1 << ' ' << *it2 << endl;
        ++it1;
    }

}


#define OSW

#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>

using namespace std;

int x1[100005];
int x2[100005];
int flag[100005];

bool cmp(const list<int> &l1, const list<int> &l2) {
    int s1 = l1.size();
    int s2 = l2.size();
    int ss1 = (x1[l1.back()]==l1.front() || x2[l1.back()]==l1.front());
    int ss2 = (x1[l2.back()]==l2.front() || x2[l2.back()]==l2.front());
    if (s1==s2) return ss1>ss2;
    else        return s1 > s2;
}

int main() {
    #ifdef OSW
    freopen("C:\\Users\\Osw\\Desktop\\in.txt","r",stdin);
    #endif // OSW
    //ios::sync_with_stdio(0);

    int a;
    int n,m;
    cin >> n >> m;
    fill(x1+1, x1+1+n, -1);
    fill(x2+1, x2+1+n, -1);
    fill(flag+1, flag+1+n, 0);
    for (int i=0; i!=m; ++i) {
        int a,b;
        cin >> a >> b;
        if (-1 == x1[a])    x1[a] = b;
        else                x2[a] = b;
        if (-1 == x1[b])    x1[b] = a;
        else                x2[b] = a;
    }

    //make list oe chain
    vector <list<int> > v;
    for (int i=1; i!=n+1; ++i) {
        if (!flag[i]) {
            v.push_back(list<int>());
            list<int>& l = v.back();
            int idx = i;
            l.push_back(idx);
            flag[idx] = 1;
            while ((-1!=x1[idx] && !flag[x1[idx]]) || (-1!=x2[idx] && !flag[x2[idx]])) {
                if (-1!=x1[idx] && !flag[x1[idx]])  idx = x1[idx];
                else                                idx = x2[idx];
                l.push_back(idx);
                flag[idx] = 1;
            }
            idx = l.front();
            while ((-1!=x1[idx] && !flag[x1[idx]]) || (-1!=x2[idx] && !flag[x2[idx]])) {
                if (-1!=x1[idx] && !flag[x1[idx]])  idx = x1[idx];
                else                                idx = x2[idx];
                l.push_front(idx);
                flag[idx] = 1;
            }
        }
    }//for vector
    sort(v.begin(), v.end(), cmp);
/*
    for (int i=0; i!=v.size(); ++i) {
        for (list<int>::iterator it = v[i].begin(); it != v[i].end();++it) {
            cout << *it << "-";
        }
        if (x1[v[i].back()]==v[i].front() || x2[v[i].back()]==v[i].front())
            cout << "circle";
        else cout << "chain";
        cout << endl;
    }
*/
    //reorder v[0]
    list<int>& l0 = v[0];
    int end0 = l0.back();
    list<int>::iterator it0 = l0.begin();
    while (*it0 != end0) {
        ++it0;
        int r0 = *it0;
        it0 = l0.erase(it0);
        l0.push_back(r0);
        if (r0 == end0) {
            l0.pop_back();
            ++it0;
            l0.insert(it0,r0);
            break;
        }
    }

    //count vacency
    list<int>::iterator it1 = l0.begin();
    list<int>::iterator it2 = it1;
    ++it2;
    int cnt = 0;
    for (; it1 != l0.end(); ++it1,++it2) {
        if (it2 == l0.end()) it2 = l0.begin();
        //cout << *it1 << ' ' << *it2 << endl;
        if (x1[*it1] == *it2 || x2[*it1] == *it2) ++cnt;
    }

    int left = n - v[0].size();

    //cout << left << '*' << cnt << endl;

    if ((left == cnt-1) &&((m == n-1) || (m == n) && (l0.size() == n))) {
        --cnt;
        while (x1[l0.back()] != l0.front() && x2[l0.back()] != l0.front()) {
            int t = l0.front();
            l0.pop_front();
            l0.push_back(t);
        }
    }
    if (left < cnt && left*2<m) {
        cout << "-1" << endl;
        return 0;
    }
    if (cnt > left) cnt = left;
    //make v0 the answer;
    for (it1 = l0.begin(); it1 != l0.end(); ++it1) {
        it2 = it1;
        ++it2;
        if (it2 == l0.end()) it2 = l0.begin();

        if (x1[*it1] == *it2 || x2[*it1] == *it2) --cnt;
        int i = v.size();

        for (int i=v.size()-1; i!=0; --i) {
            if (left > cnt) {
                int t = v[i].front();
                v[i].pop_front();
                if(v[i].empty()) v.pop_back();
                it2 = l0.insert(it2,t);
                it1 = it2;
                ++it2;
                --left;
            }
        }

    }
    it1 = l0.begin();
    for (int i=0; i!=m; ++i,++it1) {
        it2 = it1;
        ++it2;
        if (it2 == l0.end()) it2 = l0.begin();
        cout << *it1 << ' ' << *it2 << endl;
    }

}


//#define OSW

#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>

using namespace std;

int x1[100005];
int x2[100005];
int flag[100005];

bool cmp(const list<int> &l1, const list<int> &l2) {
    int s1 = l1.size();
    int s2 = l2.size();
    int ss1 = (x1[l1.back()]==l1.front() || x2[l1.back()]==l1.front());
    int ss2 = (x1[l2.back()]==l2.front() || x2[l2.back()]==l2.front());
    if (s1==s2) return ss1>ss2;
    else        return s1 > s2;
}

int main() {
    #ifdef OSW
    freopen("C:\\Users\\Osw\\Desktop\\in.txt","r",stdin);
    #endif // OSW
    //ios::sync_with_stdio(0);

    int a;
    int n,m;
    cin >> n >> m;
    fill(x1+1, x1+1+n, -1);
    fill(x2+1, x2+1+n, -1);
    fill(flag+1, flag+1+n, 0);
    for (int i=0; i!=m; ++i) {
        int a,b;
        cin >> a >> b;
        if (-1 == x1[a])    x1[a] = b;
        else                x2[a] = b;
        if (-1 == x1[b])    x1[b] = a;
        else                x2[b] = a;
    }

    //make list oe chain
    vector <list<int> > v;
    for (int i=1; i!=n+1; ++i) {
        if (!flag[i]) {
            v.push_back(list<int>());
            list<int>& l = v.back();
            int idx = i;
            l.push_back(idx);
            flag[idx] = 1;
            while ((-1!=x1[idx] && !flag[x1[idx]]) || (-1!=x2[idx] && !flag[x2[idx]])) {
                if (-1!=x1[idx] && !flag[x1[idx]])  idx = x1[idx];
                else                                idx = x2[idx];
                l.push_back(idx);
                flag[idx] = 1;
            }
            idx = l.front();
            while ((-1!=x1[idx] && !flag[x1[idx]]) || (-1!=x2[idx] && !flag[x2[idx]])) {
                if (-1!=x1[idx] && !flag[x1[idx]])  idx = x1[idx];
                else                                idx = x2[idx];
                l.push_front(idx);
                flag[idx] = 1;
            }
        }
    }//for vector
    sort(v.begin(), v.end(), cmp);
/*
    for (int i=0; i!=v.size(); ++i) {
        for (list<int>::iterator it = v[i].begin(); it != v[i].end();++it) {
            cout << *it << "-";
        }
        if (x1[v[i].back()]==v[i].front() || x2[v[i].back()]==v[i].front())
            cout << "circle";
        else cout << "chain";
        cout << endl;
    }
*/
    //reorder v[0]
    list<int>& l0 = v[0];
    int end0 = l0.back();
    list<int>::iterator it0 = l0.begin();
    while (*it0 != end0) {
        ++it0;
        int r0 = *it0;
        it0 = l0.erase(it0);
        l0.push_back(r0);
        if (r0 == end0) {
            l0.pop_back();
            ++it0;
            l0.insert(it0,r0);
            break;
        }
    }

    //count vacency
    list<int>::iterator it1 = l0.begin();
    list<int>::iterator it2 = it1;
    ++it2;
    int cnt = 0;
    for (; it1 != l0.end(); ++it1,++it2) {
        if (it2 == l0.end()) it2 = l0.begin();
        //cout << *it1 << ' ' << *it2 << endl;
        if (x1[*it1] == *it2 || x2[*it1] == *it2) ++cnt;
    }

    int left = n - v[0].size();

    //cout << left << '*' << cnt << endl;

    if ((left == cnt-1) &&((m == n-1) || (m == n) && (l0.size() == n))) {
        --cnt;
        while (x1[l0.back()] != l0.front() && x2[l0.back()] != l0.front()) {
            int t = l0.front();
            l0.pop_front();
            l0.push_back(t);
        }
    }
    if (left < cnt && left*2<m) {
        cout << "-1" << endl;
        return 0;
    }
    if (cnt > left) cnt = left;
    //make v0 the answer;
    for (it1 = l0.begin(); it1 != l0.end(); ++it1) {
        it2 = it1;
        ++it2;
        if (it2 == l0.end()) it2 = l0.begin();

        if (x1[*it1] == *it2 || x2[*it1] == *it2) --cnt;
        int i = v.size();

        for (int i=v.size()-1; i!=0; --i) {
            if (left > cnt) {
                int t = v[i].front();
                v[i].pop_front();
                if(v[i].empty()) v.pop_back();
                it2 = l0.insert(it2,t);
                it1 = it2;
                ++it2;
                --left;
            }
        }

    }
    it1 = l0.begin();
    for (int i=0; i!=m; ++i,++it1) {
        it2 = it1;
        ++it2;
        if (it2 == l0.end()) it2 = l0.begin();
        cout << *it1 << ' ' << *it2 << endl;
    }

}


//#define OSW

#include <iostream>
#include <cstdio>
#include <vector>
#include <list>
#include <algorithm>

using namespace std;

int x1[100005];
int x2[100005];
int flag[100005];

bool cmp(const list<int> &l1, const list<int> &l2) {
    int s1 = l1.size();
    int s2 = l2.size();
    int ss1 = (x1[l1.back()]==l1.front() || x2[l1.back()]==l1.front());
    int ss2 = (x1[l2.back()]==l2.front() || x2[l2.back()]==l2.front());
    if (s1==s2) return ss1>ss2;
    else        return s1 > s2;
}

int main() {
    #ifdef OSW
    freopen("C:\\Users\\Osw\\Desktop\\in.txt","r",stdin);
    #endif // OSW
    ios::sync_with_stdio(0);

    int a;
    int n,m;
    cin >> n >> m;
    fill(x1+1, x1+1+n, -1);
    fill(x2+1, x2+1+n, -1);
    fill(flag+1, flag+1+n, 0);
    for (int i=0; i!=m; ++i) {
        int a,b;
        cin >> a >> b;
        if (-1 == x1[a])    x1[a] = b;
        else                x2[a] = b;
        if (-1 == x1[b])    x1[b] = a;
        else                x2[b] = a;
    }

    //make list oe chain
    vector <list<int> > v;
    for (int i=1; i!=n+1; ++i) {
        if (!flag[i]) {
            v.push_back(list<int>());
            list<int>& l = v.back();
            int idx = i;
            l.push_back(idx);
            flag[idx] = 1;
            while ((-1!=x1[idx] && !flag[x1[idx]]) || (-1!=x2[idx] && !flag[x2[idx]])) {
                if (-1!=x1[idx] && !flag[x1[idx]])  idx = x1[idx];
                else                                idx = x2[idx];
                l.push_back(idx);
                flag[idx] = 1;
            }
            idx = l.front();
            while ((-1!=x1[idx] && !flag[x1[idx]]) || (-1!=x2[idx] && !flag[x2[idx]])) {
                if (-1!=x1[idx] && !flag[x1[idx]])  idx = x1[idx];
                else                                idx = x2[idx];
                l.push_front(idx);
                flag[idx] = 1;
            }
        }
    }//for vector
    sort(v.begin(), v.end(), cmp);
/*
    for (int i=0; i!=v.size(); ++i) {
        for (list<int>::iterator it = v[i].begin(); it != v[i].end();++it) {
            cout << *it << "-";
        }
        if (x1[v[i].back()]==v[i].front() || x2[v[i].back()]==v[i].front())
            cout << "circle";
        else cout << "chain";
        cout << endl;
    }
*/
    //reorder v[0]
    list<int>& l0 = v[0];
    int end0 = l0.back();
    list<int>::iterator it0 = l0.begin();
    while (*it0 != end0) {
        ++it0;
        int r0 = *it0;
        it0 = l0.erase(it0);
        l0.push_back(r0);
        if (r0 == end0) {
            l0.pop_back();
            ++it0;
            l0.insert(it0,r0);
            break;
        }
    }

    //count vacency
    list<int>::iterator it1 = l0.begin();
    list<int>::iterator it2 = it1;
    ++it2;
    int cnt = 0;
    for (; it1 != l0.end(); ++it1,++it2) {
        if (it2 == l0.end()) it2 = l0.begin();
        //cout << *it1 << ' ' << *it2 << endl;
        if (x1[*it1] == *it2 || x2[*it1] == *it2) ++cnt;
    }

    int left = n - v[0].size();

    //cout << left << '*' << cnt << endl;
/*
    if ((left == cnt-1) &&((m == n-1) || (m == n) && (l0.size() == n))) {
        --cnt;
        while (x1[l0.back()] != l0.front() && x2[l0.back()] != l0.front()) {
            int t = l0.front();
            l0.pop_front();
            l0.push_back(t);
        }
    }*/
    if (left < cnt && left*2<m) {
        cout << "-1" << endl;
        return 0;
    }
    if (cnt > left) cnt = left;
    //make v0 the answer;
    for (it1 = l0.begin(); it1 != l0.end(); ++it1) {
        it2 = it1;
        ++it2;
        if (it2 == l0.end()) it2 = l0.begin();

        if (x1[*it1] == *it2 || x2[*it1] == *it2) --cnt;
        int i = v.size();

        for (int i=v.size()-1; i!=0; --i) {
            if (left > cnt) {
                int t = v[i].front();
                v[i].pop_front();
                if(v[i].empty()) v.pop_back();
                it2 = l0.insert(it2,t);
                it1 = it2;
                ++it2;
                --left;
            }
        }

    }
    it1 = l0.begin();
    for (int i=0; i!=m; ++i,++it1) {
        it2 = it1;
        ++it2;
        if (it2 == l0.end()) it2 = l0.begin();
        cout << *it1 << ' ' << *it2 << endl;
    }

}


#include <iostream>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <functional>
#include <numeric>
#include <iomanip>
#include <utility>

using namespace std;

bool f[222222],first[222222],full;
int next[222222],n,h[222222][3],np,st[222222],edge=0,e[222222][3],m;

void setlink(int u, int v)
{
    if (h[u][0]) h[u][1]=v; else h[u][0]=v;
    if (h[v][0]) h[v][1]=u; else h[v][0]=u;
}

void init()
{
    memset(f,true,sizeof(f));  bool check;  int i,u,j;
    memset(next,0,sizeof(next));
    memset(first,false,sizeof(first));
    full=true;
    for (i=1;  i<=n;  i++) if (h[i][1]==0) full=false;
    for (i=1;  i<=n;  i++) if (f[i])
        {
            u=i;  first[i]=true;
            do  {
                check=false;
                for (j=0;  j<=1;  j++) if ((h[u][j])&&(f[h[u][j]]))
                    {
                        f[h[u][j]]=false;  next[u]=h[u][j];  u=h[u][j];  check=true;
                    }
            } while (check);
        }
}

void make(int u)
{
    np++;  st[np]=u;  f[u]=false;
    while (true)
        {
            if (next[u]==0) break;  u=next[u];
            if (next[u]==0) break;  u=next[u];  if (!f[u]) break;
            if ((h[st[np]][0]==u)||(h[st[np]][1]==u)) break;
            np++;  st[np]=u;  f[u]=false;
        }
}

bool kiemtra(int u, int v)
{
    return ((v!=h[u][0])&&(v!=h[u][1]));
}

void solve()
{
    np=0;  memset(f,true,sizeof(f));  int i;
    for (i=1;  i<=n;  i++) if (first[i]) make(i);
    for (i=1;  i<=n;  i++) if (first[i])
        if ((next[i]!=0)&&(f[next[i]])) make(next[i]);
    for (i=1;  i<=n;  i++) if (f[i]) make(i);
    if (!kiemtra(st[np],st[1]))
        {
            for (i=3;  i<=np-1;  i++)
                if (kiemtra(st[np],st[i-1])&&(kiemtra(st[np],st[i+1]))&&(kiemtra(st[i],st[1]))&&(kiemtra(st[i],st[np-1])))
                    {
                        int temp=st[i];  st[i]=st[np];  st[np]=temp;  break;
                    }
        }

    for (i=1;  i<=np-1;  i++) {  edge++;  e[edge][0]=st[i];  e[edge][1]=st[i+1];  }
    edge++;  e[edge][0]=st[np];  e[edge][1]=st[1];
}

void optimize()
{
    memset(f,true,sizeof(f));  int i,dem=0;
    for (i=1;  i<=edge;  i++)
        if (!kiemtra(e[i][0],e[i][1])) f[i]=false; else dem++;
    if (dem<m) {  cout <<-1;  return; }
    for (i=1;  i<=edge;  i++)  if (f[i])
        {
            printf("%d %d\n",e[i][0],e[i][1]);  m--;  if (!m) break;
        }
}

int main()
{
  //  freopen("test.inp","r",stdin);
    cin >>n>>m;  memset(h,0,sizeof(h));  int i,u,v;
    for (i=1;  i<=m;  i++) {  scanf("%d%d",&u,&v);  setlink(u,v);  }
    init();
    solve();
    optimize();
    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <functional>
#include <numeric>
#include <iomanip>
#include <utility>

using namespace std;

bool f[222222],first[222222],full;
int next[222222],n,h[222222][3],np,st[222222],edge=0,e[222222][3],m;

void setlink(int u, int v)
{
    if (h[u][0]) h[u][1]=v; else h[u][0]=v;
    if (h[v][0]) h[v][1]=u; else h[v][0]=u;
}

void init()
{
    memset(f,true,sizeof(f));  bool check;  int i,u,j;
    memset(next,0,sizeof(next));
    memset(first,false,sizeof(first));
    full=true;
    for (i=1;  i<=n;  i++) if (h[i][1]==0) full=false;
    for (i=1;  i<=n;  i++) if (f[i])
        {
            u=i;  first[i]=true;
            do  {
                check=false;
                for (j=0;  j<=1;  j++) if ((h[u][j])&&(f[h[u][j]]))
                    {
                        f[h[u][j]]=false;  next[u]=h[u][j];  u=h[u][j];  check=true;
                    }
            } while (check);
        }
}

void make(int u)
{
    np++;  st[np]=u;  f[u]=false;
    while (true)
        {
            if (next[u]==0) break;  u=next[u];
            if (next[u]==0) break;  u=next[u];  if (!f[u]) break;
            if ((h[st[np]][0]==u)||(h[st[np]][1]==u)) break;
            np++;  st[np]=u;  f[u]=false;
        }
}

bool kiemtra(int u, int v)
{
    return ((v!=h[u][0])&&(v!=h[u][1]));
}

void solve()
{
    np=0;  memset(f,true,sizeof(f));  int i;
    for (i=1;  i<=n;  i++) if (first[i]) make(i);
    for (i=1;  i<=n;  i++) if (first[i])
        if ((next[i]!=0)&&(f[next[i]])) make(next[i]);
    for (i=1;  i<=n;  i++) if (f[i]) make(i);
    for (i=1;  i<=np-1;  i++) {  edge++;  e[edge][0]=st[i];  e[edge][1]=st[i+1];  }
    if (!kiemtra(st[np],st[1]))
        {
            for (i=3;  i<=np-1;  i++)
                if (kiemtra(st[np],st[i-1])&&(kiemtra(st[np],st[i+1]))&&(kiemtra(st[i],st[1])))
                    {
                        int temp=st[i];  st[i]=st[np];  st[np]=temp;  break;
                    }
        }
    edge++;  e[edge][0]=st[np];  e[edge][1]=st[1];
}

void optimize()
{
    memset(f,true,sizeof(f));  int i,dem=0;
    for (i=1;  i<=edge;  i++)
        if (!kiemtra(e[i][0],e[i][1])) f[i]=false; else dem++;
    if (dem<m) {  cout <<-1;  return; }
    for (i=1;  i<=edge;  i++)  if (f[i])
        {
            printf("%d %d\n",e[i][0],e[i][1]);  m--;  if (!m) break;
        }
}

int main()
{
   // freopen("test.inp","r",stdin);
    cin >>n>>m;  memset(h,0,sizeof(h));  int i,u,v;
    for (i=1;  i<=m;  i++) {  scanf("%d%d",&u,&v);  setlink(u,v);  }
    init();
    solve();
    optimize();
    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <functional>
#include <numeric>
#include <iomanip>
#include <utility>

using namespace std;

bool f[222222],first[222222],full;
int next[222222],n,h[222222][3],np,st[222222],edge=0,e[222222][3],m;

void setlink(int u, int v)
{
    if (h[u][0]) h[u][1]=v; else h[u][0]=v;
    if (h[v][0]) h[v][1]=u; else h[v][0]=u;
}

void init()
{
    memset(f,true,sizeof(f));  bool check;  int i,u,j;
    memset(next,0,sizeof(next));
    memset(first,false,sizeof(first));
    for (i=1;  i<=n;  i++) if ((h[i][1]==0)&&(f[i]))
        {
            u=i;  first[i]=true;  f[i]=false;
            do  {
                check=false;
                for (j=0;  j<=1;  j++) if ((h[u][j])&&(f[h[u][j]]))
                    {
                        f[h[u][j]]=false;  next[u]=h[u][j];  u=h[u][j];  check=true;  break;
                    }
            } while (check);
        }
    for (i=1;  i<=n;  i++) if (f[i])
        {
            u=i;  first[i]=true;  f[i]=false;
            do  {
                check=false;
                for (j=0;  j<=1;  j++) if ((h[u][j])&&(f[h[u][j]]))
                    {
                        f[h[u][j]]=false;  next[u]=h[u][j];  u=h[u][j];  check=true;  break;
                    }
            } while (check);
        }
}

void make(int u)
{
    np++;  st[np]=u;  f[u]=false;  int q=u;
    while (true)
        {
            if (next[u]==0) break;  u=next[u];  if (u==q) break;
            if (next[u]==0) break;  u=next[u];  if (!f[u]) break;
            if ((h[st[np]][0]==u)||(h[st[np]][1]==u)) break;
            np++;  st[np]=u;  f[u]=false;
        }
}

bool kiemtra(int u, int v)
{
    return ((v!=h[u][0])&&(v!=h[u][1]));
}

void solve()
{
    np=0;  memset(f,true,sizeof(f));  int i;
    for (i=1;  i<=n;  i++) if (first[i]) make(i);
    for (i=1;  i<=n;  i++) if (first[i])
        if ((next[i]!=0)&&(f[next[i]])) make(next[i]);
    for (i=1;  i<=n;  i++) if (f[i]) make(i);
    if ((!kiemtra(st[np],st[1]))||(!kiemtra(st[np],st[np-1])))
        {
            for (i=2;  i<=np-2;  i++)
                if ((kiemtra(st[i],st[np]))&&(kiemtra(st[i+1],st[np])))
                    {
                        int j,temp;  temp=st[np];
                        for (j=np;  j>=i+2;  j--) st[j]=st[j-1];  st[i+1]=temp;  break;
                    }
        }

    for (i=1;  i<=np-1;  i++) {  edge++;  e[edge][0]=st[i];  e[edge][1]=st[i+1];  }
    edge++;  e[edge][0]=st[np];  e[edge][1]=st[1];
}

void optimize()
{
    memset(f,true,sizeof(f));  int i,dem=0;
    for (i=1;  i<=edge;  i++)
        if (!kiemtra(e[i][0],e[i][1])) f[i]=false; else dem++;
    if (dem<m) {  cout <<-1;  return; }
    for (i=1;  i<=edge;  i++)  if (f[i])
        {
            printf("%d %d\n",e[i][0],e[i][1]);  m--;  if (!m) break;
        }
}

int main()
{
   // freopen("test.inp","r",stdin);
    cin >>n>>m;  memset(h,0,sizeof(h));  int i,u,v;
    for (i=1;  i<=m;  i++) {  scanf("%d%d",&u,&v);  setlink(u,v);  }
    init();
    solve();
    optimize();
    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <functional>
#include <numeric>
#include <iomanip>
#include <utility>

using namespace std;

bool f[222222],first[222222],full;
int next[222222],n,h[222222][3],np,st[222222],edge=0,e[222222][3],m;

void setlink(int u, int v)
{
    if (h[u][0]) h[u][1]=v; else h[u][0]=v;
    if (h[v][0]) h[v][1]=u; else h[v][0]=u;
}

void init()
{
    memset(f,true,sizeof(f));  bool check;  int i,u,j;
    memset(next,0,sizeof(next));
    memset(first,false,sizeof(first));
    for (i=1;  i<=n;  i++) if (h[i][1]==0)
        {
            u=i;  first[i]=true;
            do  {
                check=false;
                for (j=0;  j<=1;  j++) if ((h[u][j])&&(f[h[u][j]]))
                    {
                        f[h[u][j]]=false;  next[u]=h[u][j];  u=h[u][j];  check=true;  break;
                    }
            } while (check);
        }
    for (i=1;  i<=n;  i++) if (f[i])
        {
            u=i;  first[i]=true;
            do  {
                check=false;
                for (j=0;  j<=1;  j++) if ((h[u][j])&&(f[h[u][j]]))
                    {
                        f[h[u][j]]=false;  next[u]=h[u][j];  u=h[u][j];  check=true;  break;
                    }
            } while (check);
        }
}

void make(int u)
{
    np++;  st[np]=u;  f[u]=false;  int q=u;
    while (true)
        {
            if (next[u]==0) break;  u=next[u];  if (u==q) break;
            if (next[u]==0) break;  u=next[u];  if (!f[u]) break;
            if ((h[st[np]][0]==u)||(h[st[np]][1]==u)) break;
            np++;  st[np]=u;  f[u]=false;
        }
}

bool kiemtra(int u, int v)
{
    return ((v!=h[u][0])&&(v!=h[u][1]));
}

void solve()
{
    np=0;  memset(f,true,sizeof(f));  int i;
    for (i=1;  i<=n;  i++) if (first[i]) make(i);
    for (i=1;  i<=n;  i++) if (first[i])
        if ((next[i]!=0)&&(f[next[i]])) make(next[i]);
    for (i=1;  i<=n;  i++) if (f[i]) make(i);
    if ((!kiemtra(st[np],st[1]))||(!kiemtra(st[np],st[np-1])))
        {
            for (i=2;  i<=np-2;  i++)
                if ((kiemtra(st[i],st[np]))&&(kiemtra(st[i+1],st[np])))
                    {
                        int j,temp;  temp=st[np];
                        for (j=np;  j>=i+2;  j--) st[j]=st[j-1];  st[i+1]=temp;  break;
                    }
        }

    for (i=1;  i<=np-1;  i++) {  edge++;  e[edge][0]=st[i];  e[edge][1]=st[i+1];  }
    edge++;  e[edge][0]=st[np];  e[edge][1]=st[1];
}

void optimize()
{
    memset(f,true,sizeof(f));  int i,dem=0;
    for (i=1;  i<=edge;  i++)
        if (!kiemtra(e[i][0],e[i][1])) f[i]=false; else dem++;
    if (dem<m) {  cout <<-1;  return; }
    for (i=1;  i<=edge;  i++)  if (f[i])
        {
            printf("%d %d\n",e[i][0],e[i][1]);  m--;  if (!m) break;
        }
}

int main()
{
   // freopen("test.inp","r",stdin);
    cin >>n>>m;  memset(h,0,sizeof(h));  int i,u,v;
    for (i=1;  i<=m;  i++) {  scanf("%d%d",&u,&v);  setlink(u,v);  }
    init();
    solve();
    optimize();
    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <functional>
#include <numeric>
#include <iomanip>
#include <utility>

using namespace std;

bool f[222222],first[222222],full;
int next[222222],n,h[222222][3],np,st[222222],edge=0,e[222222][3],m;

void setlink(int u, int v)
{
    if (h[u][0]) h[u][1]=v; else h[u][0]=v;
    if (h[v][0]) h[v][1]=u; else h[v][0]=u;
}

void init()
{
    memset(f,true,sizeof(f));  bool check;  int i,u,j;
    memset(next,0,sizeof(next));
    memset(first,false,sizeof(first));
    full=true;
    for (i=1;  i<=n;  i++) if (h[i][1]==0) full=false;
    for (i=1;  i<=n;  i++) if (f[i])
        {
            u=i;  first[i]=true;
            do  {
                check=false;
                for (j=0;  j<=1;  j++) if ((h[u][j])&&(f[h[u][j]]))
                    {
                        f[h[u][j]]=false;  next[u]=h[u][j];  u=h[u][j];  check=true;
                    }
            } while (check);
        }
}

void make(int u)
{
    np++;  st[np]=u;  f[u]=false;
    while (true)
        {
            if (next[u]==0) break;  u=next[u];
            if (next[u]==0) break;  u=next[u];  if (!f[u]) break;
            if ((h[st[np]][0]==u)||(h[st[np]][1]==u)) break;
            np++;  st[np]=u;  f[u]=false;
        }
}

bool kiemtra(int u, int v)
{
    return ((v!=h[u][0])&&(v!=h[u][1]));
}

void solve()
{
    np=0;  memset(f,true,sizeof(f));  int i;
    for (i=1;  i<=n;  i++) if (first[i]) make(i);
    for (i=1;  i<=n;  i++) if (first[i])
        if ((next[i]!=0)&&(f[next[i]])) make(next[i]);
    for (i=1;  i<=n;  i++) if (f[i]) make(i);
    if (!kiemtra(st[np],st[1]))
        {
            for (i=3;  i<=np-1;  i++)
                if (kiemtra(st[np],st[i-1])&&(kiemtra(st[np],st[i+1]))&&(kiemtra(st[i],st[1])))
                    {
                        int temp=st[i];  st[i]=st[np];  st[np]=temp;  break;
                    }
        }

    for (i=1;  i<=np-1;  i++) {  edge++;  e[edge][0]=st[i];  e[edge][1]=st[i+1];  }
    edge++;  e[edge][0]=st[np];  e[edge][1]=st[1];
}

void optimize()
{
    memset(f,true,sizeof(f));  int i,dem=0;
    for (i=1;  i<=edge;  i++)
        if (!kiemtra(e[i][0],e[i][1])) f[i]=false; else dem++;
    if (dem<m) {  cout <<-1;  return; }
    for (i=1;  i<=edge;  i++)  if (f[i])
        {
            printf("%d %d\n",e[i][0],e[i][1]);  m--;  if (!m) break;
        }
}

int main()
{
   // freopen("test.inp","r",stdin);
    cin >>n>>m;  memset(h,0,sizeof(h));  int i,u,v;
    for (i=1;  i<=m;  i++) {  scanf("%d%d",&u,&v);  setlink(u,v);  }
    init();
    solve();
    optimize();
    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <functional>
#include <numeric>
#include <iomanip>
#include <utility>

using namespace std;

bool f[222222],first[222222],full;
int next[222222],n,h[222222][3],np,st[222222],edge=0,e[222222][3],m;

void setlink(int u, int v)
{
    if (h[u][0]) h[u][1]=v; else h[u][0]=v;
    if (h[v][0]) h[v][1]=u; else h[v][0]=u;
}

void init()
{
    memset(f,true,sizeof(f));  bool check;  int i,u,j;
    memset(next,0,sizeof(next));
    memset(first,false,sizeof(first));
    full=true;
    for (i=1;  i<=n;  i++) if (h[i][1]==0) full=false;
    for (i=1;  i<=n;  i++) if (f[i])
        {
            u=i;  first[i]=true;
            do  {
                check=false;
                for (j=0;  j<=1;  j++) if ((h[u][j])&&(f[h[u][j]]))
                    {
                        f[h[u][j]]=false;  next[u]=h[u][j];  u=h[u][j];  check=true;  break;
                    }
            } while (check);
        }
}

void make(int u)
{
    np++;  st[np]=u;  f[u]=false;
    while (true)
        {
            if (next[u]==0) break;  u=next[u];
            if (next[u]==0) break;  u=next[u];  if (!f[u]) break;
            if ((h[st[np]][0]==u)||(h[st[np]][1]==u)) break;
            np++;  st[np]=u;  f[u]=false;
        }
}

bool kiemtra(int u, int v)
{
    return ((v!=h[u][0])&&(v!=h[u][1]));
}

void solve()
{
    np=0;  memset(f,true,sizeof(f));  int i;
    for (i=1;  i<=n;  i++) if (first[i]) make(i);
    for (i=1;  i<=n;  i++) if (first[i])
        if ((next[i]!=0)&&(f[next[i]])) make(next[i]);
    for (i=1;  i<=n;  i++) if (f[i]) make(i);
    if (!kiemtra(st[np],st[1]))
        {
            for (i=3;  i<=np-1;  i++)
                if (kiemtra(st[np],st[i-1])&&(kiemtra(st[np],st[i+1]))&&(kiemtra(st[i],st[1]))&&(kiemtra(st[i],st[np-1])))
                    {
                        int temp=st[i];  st[i]=st[np];  st[np]=temp;  break;
                    }
        }

    for (i=1;  i<=np-1;  i++) {  edge++;  e[edge][0]=st[i];  e[edge][1]=st[i+1];  }
    edge++;  e[edge][0]=st[np];  e[edge][1]=st[1];
}

void optimize()
{
    memset(f,true,sizeof(f));  int i,dem=0;
    for (i=1;  i<=edge;  i++)
        if (!kiemtra(e[i][0],e[i][1])) f[i]=false; else dem++;
    if (dem<m) {  cout <<-1;  return; }
    for (i=1;  i<=edge;  i++)  if (f[i])
        {
            printf("%d %d\n",e[i][0],e[i][1]);  m--;  if (!m) break;
        }
}

int main()
{
 //   freopen("test.inp","r",stdin);
    cin >>n>>m;  memset(h,0,sizeof(h));  int i,u,v;
    for (i=1;  i<=m;  i++) {  scanf("%d%d",&u,&v);  setlink(u,v);  }
    init();
    solve();
    optimize();
    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <functional>
#include <numeric>
#include <iomanip>
#include <utility>

using namespace std;

bool f[222222],first[222222];
int next[222222],n,h[222222][3],np,st[222222],edge=0,e[222222][3],m;

void setlink(int u, int v)
{
    if (h[u][0]) h[u][1]=v; else h[u][0]=v;
    if (h[v][0]) h[v][1]=u; else h[v][0]=u;
}

void init()
{
    memset(f,true,sizeof(f));  bool check;  int i,u,j;
    memset(next,0,sizeof(next));
    memset(first,false,sizeof(first));
    for (i=1;  i<=n;  i++) if (f[i])
        {
            u=i;  first[i]=true;
            do  {
                check=false;
                for (j=0;  j<=1;  j++) if ((h[u][j])&&(f[h[u][j]]))
                    {
                        f[h[u][j]]=false;  next[u]=h[u][j];  u=h[u][j];  check=true;
                    }
            } while (check);
        }
}

void make(int u)
{
    np++;  st[np]=u;  f[u]=false;
    while (true)
        {
            if (next[u]==0) break;  u=next[u];  if (!f[u]) break;
            if (next[u]==0) break;  u=next[u];  if (!f[u]) break;
            if ((h[st[np]][0]==u)||(h[st[np]][1]==u)) break;
            np++;  st[np]=u;  f[u]=false;
        }
}

void solve()
{
    np=0;  memset(f,true,sizeof(f));  int i;
    for (i=1;  i<=n;  i++) if (first[i]) make(i);
    for (i=1;  i<=n;  i++) if (first[i])
        if ((next[i]!=0)&&(f[next[i]])) make(next[i]);
    for (i=1;  i<=n;  i++) if (f[i]) make(i);
    for (i=1;  i<=np-1;  i++) {  edge++;  e[edge][0]=st[i];  e[edge][1]=st[i+1];  }
    edge++;  e[edge][0]=st[np];  e[edge][1]=st[1];
}

void optimize()
{
    memset(f,true,sizeof(f));  int i,dem=0;
    for (i=1;  i<=edge;  i++)
        if ((e[i][0]==h[e[i][1]][0])||(e[i][0]==h[e[i][1]][1])) f[i]=false; else dem++;
    if (dem<m) {  cout <<-1;  return; }
    for (i=1;  i<=edge;  i++)  if (f[i])
        {
            printf("%d %d\n",e[i][0],e[i][1]);  m--;  if (!m) break;
        }
}

int main()
{
  //  freopen("test.inp","r",stdin);
    cin >>n>>m;  memset(h,0,sizeof(h));  int i,u,v;
    for (i=1;  i<=m;  i++) {  scanf("%d%d",&u,&v);  setlink(u,v);  }
    init();
    solve();
    optimize();
    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <functional>
#include <numeric>
#include <iomanip>
#include <utility>

using namespace std;

bool f[222222],first[222222],full;
int next[222222],n,h[222222][3],np,st[222222],edge=0,e[222222][3],m;

void setlink(int u, int v)
{
    if (h[u][0]) h[u][1]=v; else h[u][0]=v;
    if (h[v][0]) h[v][1]=u; else h[v][0]=u;
}

void init()
{
    memset(f,true,sizeof(f));  bool check;  int i,u,j;
    memset(next,0,sizeof(next));
    memset(first,false,sizeof(first));
    for (i=1;  i<=n;  i++) if (h[i][1]==0)
        {
            u=i;  first[i]=true;
            do  {
                check=false;
                for (j=0;  j<=1;  j++) if ((h[u][j])&&(f[h[u][j]]))
                    {
                        f[h[u][j]]=false;  next[u]=h[u][j];  u=h[u][j];  check=true;  break;
                    }
            } while (check);
        }
    for (i=1;  i<=n;  i++) if (f[i])
        {
            u=i;  first[i]=true;
            do  {
                check=false;
                for (j=0;  j<=1;  j++) if ((h[u][j])&&(f[h[u][j]]))
                    {
                        f[h[u][j]]=false;  next[u]=h[u][j];  u=h[u][j];  check=true;  break;
                    }
            } while (check);
        }
}

void make(int u)
{
    np++;  st[np]=u;  f[u]=false;
    while (true)
        {
            if (next[u]==0) break;  u=next[u];
            if (next[u]==0) break;  u=next[u];  if (!f[u]) break;
            if ((h[st[np]][0]==u)||(h[st[np]][1]==u)) break;
            np++;  st[np]=u;  f[u]=false;
        }
}

bool kiemtra(int u, int v)
{
    return ((v!=h[u][0])&&(v!=h[u][1]));
}

void solve()
{
    np=0;  memset(f,true,sizeof(f));  int i;
    for (i=1;  i<=n;  i++) if (first[i]) make(i);
    for (i=1;  i<=n;  i++) if (first[i])
        if ((next[i]!=0)&&(f[next[i]])) make(next[i]);
    for (i=1;  i<=n;  i++) if (f[i]) make(i);
    if (!kiemtra(st[np],st[1]))
        {
            for (i=3;  i<=np-1;  i++)
                if (kiemtra(st[np],st[i-1])&&(kiemtra(st[np],st[i+1]))&&(kiemtra(st[i],st[1]))&&(kiemtra(st[i],st[np-1])))
                    {
                        int temp=st[i];  st[i]=st[np];  st[np]=temp;  break;
                    }
        }

    for (i=1;  i<=np-1;  i++) {  edge++;  e[edge][0]=st[i];  e[edge][1]=st[i+1];  }
    edge++;  e[edge][0]=st[np];  e[edge][1]=st[1];
}

void optimize()
{
    memset(f,true,sizeof(f));  int i,dem=0;
    for (i=1;  i<=edge;  i++)
        if (!kiemtra(e[i][0],e[i][1])) f[i]=false; else dem++;
    if (dem<m) {  cout <<-1;  return; }
    for (i=1;  i<=edge;  i++)  if (f[i])
        {
            printf("%d %d\n",e[i][0],e[i][1]);  m--;  if (!m) break;
        }
}

int main()
{
   // freopen("test.inp","r",stdin);
    cin >>n>>m;  memset(h,0,sizeof(h));  int i,u,v;
    for (i=1;  i<=m;  i++) {  scanf("%d%d",&u,&v);  setlink(u,v);  }
    init();
    solve();
    optimize();
    return 0;
}


#include <iostream>
#include <sstream>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <functional>
#include <numeric>
#include <iomanip>
#include <utility>

using namespace std;

bool f[222222],first[222222],full;
int next[222222],n,h[222222][3],np,st[222222],edge=0,e[222222][3],m;

void setlink(int u, int v)
{
    if (h[u][0]) h[u][1]=v; else h[u][0]=v;
    if (h[v][0]) h[v][1]=u; else h[v][0]=u;
}

void init()
{
    memset(f,true,sizeof(f));  bool check;  int i,u,j;
    memset(next,0,sizeof(next));
    memset(first,false,sizeof(first));
    full=true;
    for (i=1;  i<=n;  i++) if (h[i][1]==0) full=false;
    for (i=1;  i<=n;  i++) if (f[i])
        {
            u=i;  first[i]=true;
            do  {
                check=false;
                for (j=0;  j<=1;  j++) if ((h[u][j])&&(f[h[u][j]]))
                    {
                        f[h[u][j]]=false;  next[u]=h[u][j];  u=h[u][j];  check=true;
                    }
            } while (check);
        }
}

void make(int u)
{
    np++;  st[np]=u;  f[u]=false;
    while (true)
        {
            if (next[u]==0) break;  u=next[u];  if (full) if (!f[u]) break;
            if (next[u]==0) break;  u=next[u];  if (!f[u]) break;
            if ((h[st[np]][0]==u)||(h[st[np]][1]==u)) break;
            np++;  st[np]=u;  f[u]=false;
        }
}

void solve()
{
    np=0;  memset(f,true,sizeof(f));  int i;
    for (i=1;  i<=n;  i++) if (first[i]) make(i);
    for (i=1;  i<=n;  i++) if (first[i])
        if ((next[i]!=0)&&(f[next[i]])) make(next[i]);
    for (i=1;  i<=n;  i++) if (f[i]) make(i);
    for (i=1;  i<=np-1;  i++) {  edge++;  e[edge][0]=st[i];  e[edge][1]=st[i+1];  }
    edge++;  e[edge][0]=st[np];  e[edge][1]=st[1];
}

void optimize()
{
    memset(f,true,sizeof(f));  int i,dem=0;
    for (i=1;  i<=edge;  i++)
        if ((e[i][0]==h[e[i][1]][0])||(e[i][0]==h[e[i][1]][1])) f[i]=false; else dem++;
    if (dem<m) {  cout <<-1;  return; }
    for (i=1;  i<=edge;  i++)  if (f[i])
        {
            printf("%d %d\n",e[i][0],e[i][1]);  m--;  if (!m) break;
        }
}

int main()
{
 //   freopen("test.inp","r",stdin);
    cin >>n>>m;  memset(h,0,sizeof(h));  int i,u,v;
    for (i=1;  i<=m;  i++) {  scanf("%d%d",&u,&v);  setlink(u,v);  }
    init();
    solve();
    optimize();
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

#define M 100100
#define mp make_pair

using namespace std;

int n,m,x[M];
pair<int,int> p[2*M];

void read(void){
    cin>>n>>m;
    for (int x,y,i=0; i<m; ++i){
        cin>>x>>y;
        p[2*i]=mp(x,y);
        p[2*i+1]=mp(y,x);
    }
    sort(p,p+2*m);
}

void kill(void){
    for (int i=0; i<n; ++i)
    x[i]=i+1;

    for (int j=0; j<10000; ++j){
        random_shuffle(x,x+n);
        x[n]=x[0];

        bool pos=1;

        for (int i=0; i<m; ++i)
        if (binary_search(p,p+2*m,mp(x[i],x[i+1]))){
            pos=0;
            break;
        }
        if (!pos)
        continue;

        for (int i=0; i<m; ++i)
        cout<<x[i]<<" "<<x[i+1]<<"\n";
        return;
    }
    cout<<"-1\n";
}

int main()
{
    read();
    kill();
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

#define M 100100
#define mp make_pair

using namespace std;

int n,m,x[M];
pair<int,int> p[M];

void read(void){
    cin>>n>>m;
    for (int x,y,i=0; i<m; ++i){
        cin>>x>>y;
        p[i]=mp(x,y);
    }
    sort(p,p+m);
}

void kill(void){
    for (int i=0; i<n; ++i)
    x[i]=i+1;

    for (int j=0; j<10000; ++j){
        random_shuffle(x,x+n);
        x[n]=x[0];

        bool pos=1;

        for (int i=0; i<m; ++i)
        if (binary_search(p,p+m,mp(x[i],x[i+1])) || binary_search(p,p+m,mp(x[i+1],x[i]))){
            pos=0;
            break;
        }
        if (!pos)
        continue;

        for (int i=0; i<m; ++i)
        cout<<x[i]<<" "<<x[i+1]<<"\n";
        break;
    }
    cout<<"-1\n";
}

int main()
{
    read();
    kill();
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

#define M 100100
#define mp make_pair

using namespace std;

int n,m,x[M];
pair<int,int> p[M];

void read(void){
    cin>>n>>m;
    for (int x,y,i=0; i<m; ++i){
        cin>>x>>y;
        p[2*i]=mp(x,y);
        p[2*i+1]=mp(y,x);
    }
    sort(p,p+2*m);
}

void kill(void){
    for (int i=0; i<n; ++i)
    x[i]=i+1;

    for (int j=0; j<10000; ++j){
        random_shuffle(x,x+n);
        x[n]=x[0];

        bool pos=1;

        for (int i=0; i<m; ++i)
        if (binary_search(p,p+2*m,mp(x[i],x[i+1]))){
            pos=0;
            break;
        }
        if (!pos)
        continue;

        for (int i=0; i<m; ++i)
        cout<<x[i]<<" "<<x[i+1]<<"\n";
        return;
    }
    cout<<"-1\n";
}

int main()
{
    read();
    kill();
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

#define M 100100
#define mp make_pair

using namespace std;

int n,m,x[M];
pair<int,int> p[M];

void read(void){
    cin>>n>>m;
    for (int x,y,i=0; i<m; ++i){
        cin>>x>>y;
        p[i]=mp(x,y);
    }
    sort(p,p+m);
}

void kill(void){
    for (int i=0; i<n; ++i)
    x[i]=i+1;

    for (int j=0; j<10000; ++j){
        random_shuffle(x,x+n);
        x[n]=x[0];

        bool pos=1;

        for (int i=0; i<m; ++i)
        if (binary_search(p,p+m,mp(x[i],x[i+1])) || binary_search(p,p+m,mp(x[i+1],x[i]))){
            pos=0;
            break;
        }
        if (!pos)
        continue;

        for (int i=0; i<m; ++i)
        cout<<x[i]<<" "<<x[i+1]<<"\n";
        return;
    }
    cout<<"-1\n";
}

int main()
{
    read();
    kill();
    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>

#define M 100100
#define mp make_pair

using namespace std;

int n,m,x[M];
pair<int,int> p[M];

void read(void){
    cin>>n>>m;
    for (int x,y,i=0; i<m; ++i){
        cin>>x>>y;
        p[2*i]=mp(x,y);
        p[2*i+1]=mp(y,x);
    }
    m*=2;
    sort(p,p+m);
}

void kill(void){
    for (int i=0; i<n; ++i)
    x[i]=i+1;

    for (int j=0; j<10000; ++j){
        random_shuffle(x,x+n);
        x[n]=x[0];

        bool pos=1;

        for (int i=0; i<m; ++i)
        if (binary_search(p,p+m,mp(x[i],x[i+1]))){
            pos=0;
            break;
        }
        if (!pos)
        continue;

        for (int i=0; i<m; ++i)
        cout<<x[i]<<" "<<x[i+1]<<"\n";
        return;
    }
    cout<<"-1\n";
}

int main()
{
    read();
    kill();
    return 0;
}


// in the name of God

#include<bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define ll long long
#define ld long double
#define s(a) scanf("%d" , &a)
#define p(a) printf("%d " , a)
#define mem(A) memset(A , 0 , sizeof A)

using namespace std;

typedef pair<int , int> pii;

const int MAXN = 1e5 + 2015;

int out[MAXN];
int flag[MAXN];

vector<int> edges[MAXN];

int main()
{
    ios_base::sync_with_stdio(false);
    int n , m;
    cin >> n >> m;
    for(int i = 1 ; i <= m ; i++){
        int fi , se;
        cin >> fi >> se;
        edges[fi].pb(se);
        edges[se].pb(fi);
    }
    for(int i = 1 ; i <= n ; i++)
        out[i] = i;

    for(int k = 0 ; k < 50 ; k++){
        bool ok = true;
        random_shuffle(out+1 , out+n+1);
        out[n+1] = out[1];
        for(int i = 1 ; i <= m ; i++){
            int u = out[i] , v = out[i+1];
            for(int i = 0 ; i < edges[u].size() ; i++)
                if(edges[u][i] == v || v == u)
                    ok = false;
        }
        if(ok){
            for(int i = 1 ; i <= m ; i++)
                cout << out[i] << " " << out[i+1] << "\n";
            return 0;
        }
    }
    cout << -1 << "\n";

    return 0;
}


// in the name of God

#include<bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define ll long long
#define ld long double
#define s(a) scanf("%d" , &a)
#define p(a) printf("%d " , a)
#define mem(A) memset(A , 0 , sizeof A)

using namespace std;

typedef pair<int , int> pii;

const int MAXN = 1e5 + 2015;

int out[MAXN];
int flag[MAXN];

vector<int> edges[MAXN];

int main()
{
    ios_base::sync_with_stdio(false);
    int n , m;
    cin >> n >> m;
    for(int i = 1 ; i <= m ; i++){
        int fi , se;
        cin >> fi >> se;
        edges[fi].pb(se);
        edges[se].pb(fi);
    }

    int id = 0;
    for(int i = 1 ; i <= n ; i++)
        if(!flag[i]){
            queue<int> q;
            q.push(i);
            flag[i] = 1;
            out[++id] = i;
            while(q.size()){
                int x = q.front();
                q.pop();
                for(int i = 0 ; i < edges[x].size() ; i++){
                    int h = edges[x][i];
                    if(!flag[h]){
                        q.push(h);
                        flag[h] = 1;
                        out[++id] = h;
                    }
                }
            }
        }
    out[++id] = out[1];
    out[++id] = out[2];
    out[++id] = out[3];

    for(int i = 1 ; i <= m ; i++){
        int u = out[i] , v = out[i+3];
        for(int i = 0 ; i < edges[u].size() ; i++)
            if(edges[u][i] == v || v == u){
                cout << -1 << "\n";
                return 0;
            }
    }
    for(int i = 1 ; i <= m ; i++)
        cout << out[i] << " " << out[i+3] << "\n";

    return 0;
}


// in the name of God

#include<bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define ll long long
#define ld long double
#define s(a) scanf("%d" , &a)
#define p(a) printf("%d " , a)
#define mem(A) memset(A , 0 , sizeof A)

using namespace std;

typedef pair<int , int> pii;

const int MAXN = 1e5 + 2015;

int out[MAXN];
int flag[MAXN];

vector<int> edges[MAXN];

int main()
{
    ios_base::sync_with_stdio(false);
    int n , m;
    cin >> n >> m;
    for(int i = 1 ; i <= m ; i++){
        int fi , se;
        cin >> fi >> se;
        edges[fi].pb(se);
        edges[se].pb(fi);
    }

    int id = 0;
    for(int i = 1 ; i <= n ; i++)
        if(!flag[i]){
            queue<int> q;
            q.push(i);
            flag[i] = 1;
            out[++id] = i;
            while(q.size()){
                int x = q.front();
                q.pop();
                for(int i = 0 ; i < edges[x].size() ; i++){
                    int h = edges[x][i];
                    if(!flag[h]){
                        q.push(h);
                        flag[h] = 1;
                        out[++id] = h;
                    }
                }
            }
        }
    out[++id] = out[1];
    out[++id] = out[2];
    out[++id] = out[3];

    for(int i = 1 ; i <= m ; i++)
        cout << out[i] << " " << out[i+3] << "\n";

    return 0;
}


// in the name of God

#include<bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define ll long long
#define ld long double
#define s(a) scanf("%d" , &a)
#define p(a) printf("%d " , a)
#define mem(A) memset(A , 0 , sizeof A)

using namespace std;

typedef pair<int , int> pii;

const int MAXN = 1e5 + 2015;

int out[MAXN];
int flag[MAXN];

vector<int> edges[MAXN];

int main()
{
    ios_base::sync_with_stdio(false);
    int n , m;
    cin >> n >> m;
    for(int i = 1 ; i <= m ; i++){
        int fi , se;
        cin >> fi >> se;
        edges[fi].pb(se);
        edges[se].pb(fi);
    }

    int id = 0;
    for(int i = n ; i ; i--)
        if(!flag[i]){
            queue<int> q;
            q.push(i);
            flag[i] = 1;
            out[++id] = i;
            while(q.size()){
                int x = q.front();
                q.pop();
                for(int j = edges[x].size()-1 ; j+1 ; j--){
                    int h = edges[x][j];
                    if(!flag[h]){
                        q.push(h);
                        flag[h] = 1;
                        out[++id] = h;
                    }
                }
            }
        }
    out[++id] = out[1];
    out[++id] = out[2];
    out[++id] = out[3];

    for(int i = 1 ; i <= m ; i++){
        int u = out[i] , v = out[i+3];
        for(int i = 0 ; i < edges[u].size() ; i++)
            if(edges[u][i] == v || v == u){
                cout << -1 << "\n";
                return 0;
            }
    }
    for(int i = 1 ; i <= m ; i++)
        cout << out[i] << " " << out[i+3] << "\n";

    return 0;
}


#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#define f cin
#define g cout
#define NM 100010

using namespace std;

int N, M;
int NewM;
set<int> G[NM];
int DG[NM];
int Remaining[NM];
vector< pair<int, int> > Edges;
map< pair<int, int>, bool > Map;
set<int> Available;
set<int>::iterator lower, par;

vector< pair<int, int> > Sorted;

bool Check (int nod, int vec)
{
    if (vec<1 || vec>N || vec==nod) return 0;
    if (G[nod].find(vec)!=G[nod].end()) return 0;
    if (Remaining[nod]<=0 || Remaining[vec]<=0) return 0;

    if (Map[make_pair(nod, vec)]==1) return 0;

    return 1;
}

void Match (int nod, int vec)
{
    Map[make_pair(nod, vec)]=1;
    Map[make_pair(vec, nod)]=1;
    Edges.push_back(make_pair(nod, vec));

    Remaining[nod]--;
    if (Remaining[nod]<=0)
        Available.erase(nod);

    Remaining[vec]--;
    if (Remaining[vec]<=0)
        Available.erase(vec);
}

void Solve (int nod)
{
    if (Edges.size()>=M) return;
    if (Remaining[nod]<=0) return;

    int minirem=999999, minig=999999;
    int p=-1;

    for (set<int>::iterator it=G[nod].begin(); it!=G[nod].end(); ++it)
    {
        int vec=*it;
        int pas;

        lower=Available.lower_bound(vec);

        for (pas=0, par=lower; pas<=20 && par!=Available.end(); pas++, ++par)
            if (Check(nod, *par))
            {
                if (Remaining[*par]<minirem || (Remaining[*par]==minirem && (N-1-G[*par].size()<minig)))
                {
                    p=*par;
                    minirem=Remaining[*par];
                    minig=N-1-G[*par].size();
                }
            }

        for (pas=0, par=lower; pas<=20 && par!=Available.begin(); pas++)
        {
            par--;
            if (Check(nod, *par))
            {
                if (Remaining[*par]<minirem || (Remaining[*par]==minirem && (N-1-G[*par].size()<minig)))
                {
                    p=*par;
                    minirem=Remaining[*par];
                    minig=N-1-G[*par].size();
                }
            }
        }
    }

    if (p!=-1)
        Match(nod, p);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("test.in","r",stdin);
    freopen("test.out","w",stdout);
    #endif

    f >> N >> M;

    for (int i=1; i<=M; i++)
    {
        int a, b;
        f >> a >> b;
        G[a].insert(b);
        G[b].insert(a);

        DG[a]++;
        DG[b]++;
    }

    for (int i=1; i<=N; i++)
    {
        Remaining[i]=min(2, N-(int)G[i].size()-1);
        NewM+=min(2, N-(int)G[i].size()-1);

        if (Remaining[i]>0)
            Available.insert(i);

        Sorted.push_back(make_pair(N-(int)G[i].size()-1, i));
    }

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

    NewM/=2;
    if (NewM<M)
    {
        g << -1 << '\n';

        return 0;
    }

    for (int i=0; i<Sorted.size(); i++)
    {
        int j=Sorted[i].second;
        if (Remaining[j]>0)
            Solve(j);
        if (Remaining[i]>0)
            Solve(j);
    }

    if (Edges.size()<M)
    {
        g << -1 << '\n';
        return 0;
    }

    for (int i=0; i<Edges.size(); i++)
        g << Edges[i].first << ' ' << Edges[i].second << '\n';

    return 0;
}


#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#define f cin
#define g cout
#define NM 100010
#define node first
#define remm second.first
#define tsize second.second

using namespace std;

typedef pair<int, int> PI;

int N, M;
int NewM;
set<int> G[NM];
int DG[NM];
int Remaining[NM];
vector< pair<int, int> > Edges;
map< pair<int, int>, bool > Map;

typedef pair<int, pair<int, int> > PPP;

struct CMP
{
    bool operator () (const PPP& a, const PPP& b) const
    {
        if (a.rem!=b.rem) return a.rem<b.rem;

        return (a.tsize)<(b.tsize);
    }
};

set< PPP, CMP > Set;
vector< PI > Sorted;

void Solve (int nod)
{
    if (Edges.size()>=M) return;
    if (Remaining[nod]<=0) return;

    int vec;
    Set.erase(nod);
    for (set<int>::iterator it=G[nod].begin(); it!=G[nod].end(); ++it)
        Set.erase(vec=*it);

    for (set<int, CMP>::iterator it=Set.begin(); it!=Set.end(); ++it)
        if (Map[make_pair(nod, vec=*it)]==0)
        {
            Edges.push_back(make_pair(nod, *it));
            Map[make_pair(nod, *it)]=1;
            Map[make_pair(*it, nod)]=1;

            Remaining[nod]--;
            Remaining[*it]--;
            if (Remaining[*it]<=0)
                Set.erase(*it);

            break;
        }

    if (Remaining[nod]>0)
        Set.insert(nod);

    for (set<int>::iterator it=G[nod].begin(); it!=G[nod].end(); ++it)
        if (Remaining[*it]>0)
            Set.insert(*it);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("test.in","r",stdin);
    freopen("test.out","w",stdout);
    #endif

    f >> N >> M;

    for (int i=1; i<=M; i++)
    {
        int a, b;
        f >> a >> b;
        G[a].insert(b);
        G[b].insert(a);

        DG[a]++;
        DG[b]++;
    }

    for (int i=1; i<=N; i++)
    {
        Remaining[i]=min(2, N-1-(int)G[i].size());
        NewM+=Remaining[i];

        if (Remaining[i]>0)
        {
            Set.insert(make_pair(i, make_pair(Remaining[i], N-(int)G[i].size()-1)));
            Sorted.push_back(make_pair(N-1-(int)G[i].size(), i));
        }
    }

    NewM/=2;
    if (NewM<M)
    {
        g << -1 << '\n';

        return 0;
    }

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

    for (int i=0; i<Sorted.size(); i++)
    {
        int j=Sorted[i].second;

        if (Remaining[j]>0)
            Solve(j);

        if (Remaining[j]>0)
            Solve(j);
    }

    if (Edges.size()<M)
    {
        g << -1 << '\n';

        return 0;
    }

    for (int i=0; i<Edges.size(); i++)
        g << Edges[i].first << ' ' << Edges[i].second << '\n';

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <set>
#include <ctime>
#define f cin
#define g cout
#define NM 100010

using namespace std;

int N, M;
set<int> G[NM];
int Perm[NM];

int urm (int i)
{
    return (i<N?i+1:1);
}

bool Generate ()
{
    for (int i=1; i<=N; i++)
        Perm[i]=i;

    for (int i=1; i<=N; i++)
    {
        int j=i+rand()%(N-i+1);
        swap(Perm[i], Perm[j]);
    }

    for (int i=1; i<=N; i++)
        if (G[Perm[i]].find(Perm[urm(i)])!=G[Perm[i]].end())
            return 0;

    return 1;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("test.in","r",stdin);
    freopen("test.out","w",stdout);
    #endif

    srand(time(0));

    f >> N >> M;
    for (int i=1; i<=M; i++)
    {
        int a, b;
        f >> a >> b;
        G[a].insert(b);
        G[b].insert(a);
    }

    for (int p=1; p<=1000; p++)
        if (Generate())
        {
            for (int i=1; i<=M; i++)
            {
                int j=urm(i);
                g << Perm[i] << ' ' << Perm[j] << '\n';
            }

            return 0;
        }

    g << -1 << '\n';

    return 0;
}


#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#define f cin
#define g cout
#define NM 100010

using namespace std;

int N, M;
int NewM;
set<int> G[NM];
int DG[NM];
int Remaining[NM];
vector< pair<int, int> > Edges;
map< pair<int, int>, bool > Map;
set<int> Available;
set<int>::iterator lower, par;

vector< pair<int, int> > Sorted;

bool Check (int nod, int vec)
{
    if (vec<1 || vec>N || vec==nod) return 0;
    if (G[nod].find(vec)!=G[nod].end()) return 0;
    if (Remaining[nod]<=0 || Remaining[vec]<=0) return 0;

    if (Map[make_pair(nod, vec)]==1) return 0;

    return 1;
}

void Match (int nod, int vec)
{
    Map[make_pair(nod, vec)]=1;
    Map[make_pair(vec, nod)]=1;
    Edges.push_back(make_pair(nod, vec));

    Remaining[nod]--;
    if (Remaining[nod]<=0)
        Available.erase(nod);

    Remaining[vec]--;
    if (Remaining[vec]<=0)
        Available.erase(vec);
}

void Solve (int nod)
{
    if (Edges.size()>=M) return;
    if (Remaining[nod]<=0) return;

    int minirem=999999, minig=999999;
    int p=-1;

    for (set<int>::iterator it=G[nod].begin(); it!=G[nod].end(); ++it)
    {
        int vec=*it;
        int pas;

        lower=Available.lower_bound(vec);

        for (pas=0, par=lower; pas<=30 && par!=Available.end(); pas++, ++par)
            if (Check(nod, *par))
            {
                if (Remaining[*par]<minirem || (Remaining[*par]==minirem && (N-1-G[*par].size()<minig)))
                {
                    p=*par;
                    minirem=Remaining[*par];
                    minig=N-1-G[*par].size();
                }
            }

        for (pas=0, par=lower; pas<=30 && par!=Available.begin(); pas++)
        {
            par--;
            if (Check(nod, *par))
            {
                if (Remaining[*par]<minirem || (Remaining[*par]==minirem && (N-1-G[*par].size()<minig)))
                {
                    p=*par;
                    minirem=Remaining[*par];
                    minig=N-1-G[*par].size();
                }
            }
        }
    }

    if (p!=-1)
        Match(nod, p);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("test.in","r",stdin);
    freopen("test.out","w",stdout);
    #endif

    f >> N >> M;

    for (int i=1; i<=M; i++)
    {
        int a, b;
        f >> a >> b;
        G[a].insert(b);
        G[b].insert(a);

        DG[a]++;
        DG[b]++;
    }

    for (int i=1; i<=N; i++)
    {
        Remaining[i]=min(2, N-(int)G[i].size()-1);
        NewM+=min(2, N-(int)G[i].size()-1);

        if (Remaining[i]>0)
            Available.insert(i);

        Sorted.push_back(make_pair(N-(int)G[i].size()-1, i));
    }

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

    NewM/=2;
    if (NewM<M)
    {
        g << -1 << '\n';

        return 0;
    }

    for (int i=0; i<Sorted.size(); i++)
    {
        int j=Sorted[i].second;
        if (Remaining[j]>0)
            Solve(j);
        if (Remaining[i]>0)
            Solve(j);
    }

    if (Edges.size()<M)
    {
        g << -1 << '\n';
        return 0;
    }

    for (int i=0; i<Edges.size(); i++)
        g << Edges[i].first << ' ' << Edges[i].second << '\n';

    return 0;
}


#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#define f cin
#define g cout
#define NM 100010

using namespace std;

int N, M;
int NewM;
set<int> G[NM];
int DG[NM];
int Remaining[NM];
vector< pair<int, int> > Edges;
map< pair<int, int>, bool > Map;
set<int> Available;
set<int>::iterator lower, par;

vector< pair<int, int> > Sorted;

bool Check (int nod, int vec)
{
    if (vec<1 || vec>N || vec==nod) return 0;
    if (G[nod].find(vec)!=G[nod].end()) return 0;
    if (Remaining[nod]<=0 || Remaining[vec]<=0) return 0;

    if (Map[make_pair(nod, vec)]==1) return 0;

    return 1;
}

void Match (int nod, int vec)
{
    Map[make_pair(nod, vec)]=1;
    Map[make_pair(vec, nod)]=1;
    Edges.push_back(make_pair(nod, vec));

    Remaining[nod]--;
    if (Remaining[nod]<=0)
        Available.erase(nod);

    Remaining[vec]--;
    if (Remaining[vec]<=0)
        Available.erase(vec);
}

void Solve (int nod)
{
    if (Edges.size()>=M) return;
    if (Remaining[nod]<=0) return;

    int minirem=999999, minig=999999;
    int p=-1;

    for (set<int>::iterator it=G[nod].begin(); it!=G[nod].end(); ++it)
    {
        int vec=*it;
        int pas;

        lower=Available.lower_bound(vec);

        for (pas=0, par=lower; pas<=15 && par!=Available.end(); pas++, ++par)
            if (Check(nod, *par))
            {
                if (Remaining[*par]<minirem || (Remaining[*par]==minirem && (N-1-G[*par].size()<minig)))
                {
                    p=*par;
                    minirem=Remaining[*par];
                    minig=N-1-G[*par].size();
                }
            }

        for (pas=0, par=lower; pas<=15 && par!=Available.begin(); pas++)
        {
            par--;
            if (Check(nod, *par))
            {
                if (Remaining[*par]<minirem || (Remaining[*par]==minirem && (N-1-G[*par].size()<minig)))
                {
                    p=*par;
                    minirem=Remaining[*par];
                    minig=N-1-G[*par].size();
                }
            }
        }
    }

    if (p!=-1)
        Match(nod, p);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("test.in","r",stdin);
    freopen("test.out","w",stdout);
    #endif

    f >> N >> M;

    for (int i=1; i<=M; i++)
    {
        int a, b;
        f >> a >> b;
        G[a].insert(b);
        G[b].insert(a);

        DG[a]++;
        DG[b]++;
    }

    for (int i=1; i<=N; i++)
    {
        Remaining[i]=min(2, N-(int)G[i].size()-1);
        NewM+=min(2, N-(int)G[i].size()-1);

        if (Remaining[i]>0)
            Available.insert(i);

        Sorted.push_back(make_pair(N-(int)G[i].size()-1, i));
    }

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

    NewM/=2;
    if (NewM<M)
    {
        g << -1 << '\n';

        return 0;
    }

    for (int i=0; i<Sorted.size(); i++)
    {
        int j=Sorted[i].second;
        if (Remaining[j]>0)
            Solve(j);
        if (Remaining[i]>0)
            Solve(j);
    }

    if (Edges.size()<M)
    {
        g << -1 << '\n';
        return 0;
    }

    for (int i=0; i<Edges.size(); i++)
        g << Edges[i].first << ' ' << Edges[i].second << '\n';

    return 0;
}


#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#define f cin
#define g cout
#define NM 100010

using namespace std;

int N, M;
int NewM;
set<int> G[NM];
int DG[NM];
int Remaining[NM];
vector< pair<int, int> > Edges;
map< pair<int, int>, bool > Map;
set<int> Available;
set<int>::iterator lower, par;

vector< pair<int, int> > Sorted;

bool Check (int nod, int vec)
{
    if (vec<1 || vec>N || vec==nod) return 0;
    if (G[nod].find(vec)!=G[nod].end()) return 0;
    if (Remaining[nod]<=0 || Remaining[vec]<=0) return 0;

    if (Map[make_pair(nod, vec)]==1) return 0;

    return 1;
}

void Match (int nod, int vec)
{
    Map[make_pair(nod, vec)]=1;
    Map[make_pair(vec, nod)]=1;
    Edges.push_back(make_pair(nod, vec));

    Remaining[nod]--;
    if (Remaining[nod]<=0)
        Available.erase(nod);

    Remaining[vec]--;
    if (Remaining[vec]<=0)
        Available.erase(vec);
}

void Solve (int nod)
{
    if (Edges.size()>=M) return;
    if (Remaining[nod]<=0) return;

    int minirem=999999, minig=999999;
    int p=-1;

    for (set<int>::iterator it=G[nod].begin(); it!=G[nod].end(); ++it)
    {
        int vec=*it;
        int pas;

        lower=Available.lower_bound(vec);

        for (pas=0, par=lower; pas<=5 && par!=Available.end(); pas++, ++par)
            if (Check(nod, *par))
            {
                if (Remaining[*par]<minirem || (Remaining[*par]==minirem && (N-1-G[*par].size()<minig)))
                {
                    p=*par;
                    minirem=Remaining[*par];
                    minig=N-1-G[*par].size();
                }
            }

        for (pas=0, par=lower; pas<=5 && par!=Available.begin(); pas++)
        {
            par--;
            if (Check(nod, *par))
            {
                if (Remaining[*par]<minirem || (Remaining[*par]==minirem && (N-1-G[*par].size()<minig)))
                {
                    p=*par;
                    minirem=Remaining[*par];
                    minig=N-1-G[*par].size();
                }
            }
        }
    }

    if (p!=-1)
        Match(nod, p);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("test.in","r",stdin);
    freopen("test.out","w",stdout);
    #endif

    f >> N >> M;

    for (int i=1; i<=M; i++)
    {
        int a, b;
        f >> a >> b;
        G[a].insert(b);
        G[b].insert(a);

        DG[a]++;
        DG[b]++;
    }

    for (int i=1; i<=N; i++)
    {
        Remaining[i]=min(2, N-(int)G[i].size()-1);
        NewM+=min(2, N-(int)G[i].size()-1);

        if (Remaining[i]>0)
            Available.insert(i);

        Sorted.push_back(make_pair(N-(int)G[i].size()-1, i));
    }

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

    NewM/=2;
    if (NewM<M)
    {
        g << -1 << '\n';

        return 0;
    }

    for (int i=0; i<Sorted.size(); i++)
    {
        int j=Sorted[i].second;
        if (Remaining[j]>0)
            Solve(j);
        if (Remaining[i]>0)
            Solve(j);
    }

    if (Edges.size()<M)
    {
        g << -1 << '\n';
        return 0;
    }

    for (int i=0; i<Edges.size(); i++)
        g << Edges[i].first << ' ' << Edges[i].second << '\n';

    return 0;
}


#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#define f cin
#define g cout
#define NM 100010

using namespace std;

int N, M;
int NewM;
set<int> G[NM];
int DG[NM];
int Remaining[NM];
vector< pair<int, int> > Edges;
map< pair<int, int>, bool > Map;
set<int> Available;
set<int>::iterator lower, par;

vector< pair<int, int> > Sorted;

bool Check (int nod, int vec)
{
    if (vec<1 || vec>N || vec==nod) return 0;
    if (G[nod].find(vec)!=G[nod].end()) return 0;
    if (Remaining[nod]<=0 || Remaining[vec]<=0) return 0;

    if (Map[make_pair(nod, vec)]==1) return 0;

    return 1;
}

void Match (int nod, int vec)
{
    Map[make_pair(nod, vec)]=1;
    Map[make_pair(vec, nod)]=1;
    Edges.push_back(make_pair(nod, vec));

    Remaining[nod]--;
    if (Remaining[nod]<=0)
        Available.erase(nod);

    Remaining[vec]--;
    if (Remaining[vec]<=0)
        Available.erase(vec);
}

void Solve (int nod)
{
    if (Edges.size()>=M) return;
    if (Remaining[nod]<=0) return;

    int minirem=999999, minig=999999;
    int p=-1;

    for (set<int>::iterator it=G[nod].begin(); it!=G[nod].end(); ++it)
    {
        int vec=*it;
        int pas;

        lower=Available.lower_bound(vec);

        for (pas=0, par=lower; pas<=10 && par!=Available.end(); pas++, ++par)
            if (Check(nod, *par))
            {
                if (Remaining[*par]<minirem || (Remaining[*par]==minirem && (N-1-G[*par].size()<minig)))
                {
                    p=*par;
                    minirem=Remaining[*par];
                    minig=N-1-G[*par].size();
                }
            }

        for (pas=0, par=lower; pas<=10 && par!=Available.begin(); pas++)
        {
            par--;
            if (Check(nod, *par))
            {
                if (Remaining[*par]<minirem || (Remaining[*par]==minirem && (N-1-G[*par].size()<minig)))
                {
                    p=*par;
                    minirem=Remaining[*par];
                    minig=N-1-G[*par].size();
                }
            }
        }
    }

    if (p!=-1)
        Match(nod, p);
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("test.in","r",stdin);
    freopen("test.out","w",stdout);
    #endif

    f >> N >> M;

    for (int i=1; i<=M; i++)
    {
        int a, b;
        f >> a >> b;
        G[a].insert(b);
        G[b].insert(a);

        DG[a]++;
        DG[b]++;
    }

    for (int i=1; i<=N; i++)
    {
        Remaining[i]=min(2, N-(int)G[i].size()-1);
        NewM+=min(2, N-(int)G[i].size()-1);

        if (Remaining[i]>0)
            Available.insert(i);

        Sorted.push_back(make_pair(N-(int)G[i].size()-1, i));
    }

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

    NewM/=2;
    if (NewM<M)
    {
        g << -1 << '\n';

        return 0;
    }

    for (int i=0; i<Sorted.size(); i++)
    {
        int j=Sorted[i].second;
        if (Remaining[j]>0)
            Solve(j);
        if (Remaining[i]>0)
            Solve(j);
    }

    if (Edges.size()<M)
    {
        g << -1 << '\n';
        return 0;
    }

    for (int i=0; i<Edges.size(); i++)
        g << Edges[i].first << ' ' << Edges[i].second << '\n';

    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <set>
#include <ctime>
#define f cin
#define g cout
#define NM 100010

using namespace std;

int N, M;
set<int> G[NM];
int Perm[NM];

int urm (int i)
{
    return (i<N?i+1:1);
}

bool Generate ()
{
    for (int i=1; i<=N; i++)
        Perm[i]=i;

    for (int i=N; i>=2; i--)
    {
        int j=rand()%i+1;
        swap(Perm[i], Perm[j]);
    }

    for (int i=1; i<=M; i++)
        if (G[Perm[i]].find(Perm[urm(i)])!=G[Perm[i]].end())
            return 0;

    return 1;
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("test.in","r",stdin);
    freopen("test.out","w",stdout);
    #endif

    //srand(time(0));

    f >> N >> M;
    for (int i=1; i<=M; i++)
    {
        int a, b;
        f >> a >> b;
        G[a].insert(b);
        G[b].insert(a);
    }

    for (int p=1; p<=1000; p++)
        if (Generate())
        {
            for (int i=1; i<=M; i++)
            {
                int j=urm(i);
                g << Perm[i] << ' ' << Perm[j] << '\n';
            }

            return 0;
        }

    g << -1 << '\n';

    return 0;
}


#include <iostream>
#include <cstdio>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
#define f cin
#define g cout
#define NM 100010

using namespace std;

int N, M;
int NewM;
set<int> G[NM];
int DG[NM];
int Remaining[NM];
vector< pair<int, int> > Edges;
map< pair<int, int>, bool > Map;
set<int> Available;
set<int>::iterator lower, par;

vector< pair<int, int> > Sorted;

bool Check (int nod, int vec)
{
    if (vec<1 || vec>N || vec==nod) return 0;
    if (G[nod].find(vec)!=G[nod].end()) return 0;
    if (Remaining[nod]<=0 || Remaining[vec]<=0) return 0;

    if (Map[make_pair(nod, vec)]==1) return 0;

    Map[make_pair(nod, vec)]=1;
    Map[make_pair(vec, nod)]=1;
    Edges.push_back(make_pair(nod, vec));

    Remaining[nod]--;
    if (Remaining[nod]<=0)
        Available.erase(nod);

    Remaining[vec]--;
    if (Remaining[vec]<=0)
        Available.erase(vec);

    return 1;
}

void Solve (int nod)
{
    if (Edges.size()>=M) return;
    if (Remaining[nod]<=0) return;

    for (set<int>::iterator it=G[nod].begin(); it!=G[nod].end(); ++it)
    {
        int vec=*it;
        int pas;

        lower=Available.lower_bound(vec);

        for (pas=0, par=lower; pas<=10 && par!=Available.end(); pas++, ++par)
            if (Check(nod, *par))
                return;

        for (pas=0, par=lower; pas<=10 && par!=Available.begin(); pas++)
        {
            par--;
            if (Check(nod, *par))
                return;
        }
    }
}

int main()
{
    #ifndef ONLINE_JUDGE
    freopen("test.in","r",stdin);
    freopen("test.out","w",stdout);
    #endif

    f >> N >> M;

    for (int i=1; i<=M; i++)
    {
        int a, b;
        f >> a >> b;
        G[a].insert(b);
        G[b].insert(a);

        DG[a]++;
        DG[b]++;
    }

    for (int i=1; i<=N; i++)
    {
        Remaining[i]=min(2, N-(int)G[i].size()-1);
        NewM+=min(2, N-(int)G[i].size()-1);

        if (Remaining[i]>0)
            Available.insert(i);

        Sorted.push_back(make_pair(N-(int)G[i].size()-1, i));
    }

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

    NewM/=2;
    if (NewM<M)
    {
        g << -1 << '\n';

        return 0;
    }

    for (int i=0; i<Sorted.size(); i++)
    {
        int j=Sorted[i].second;
        if (Remaining[j]>0)
            Solve(j);
        if (Remaining[i]>0)
            Solve(j);
    }

    if (Edges.size()<M)
    {
        g << -1 << '\n';
        return 0;
    }

    for (int i=0; i<Edges.size(); i++)
        g << Edges[i].first << ' ' << Edges[i].second << '\n';

    return 0;
}


#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<map>
#include<stack>
#include<queue>
#include<cmath>
#include<vector>
#include<cstring>
#include<string>
#include<limits>
#include<set>

using namespace std;

#define M 100010
#define N 1010
#define mod 1000000007
#define pi acos(-1.0)
#define inf (1<<30)
#define ls p<<1
#define rs p<<1|1
//#pragma comment(linker, "/STACK:102400000")
typedef long long ll;

int n, m;
vector<int> vec[M];
vector<int> vv[M];
int x[M], y[M];
set<int> st;

bool can( int u, int v )
{
    for( int i = 0; i < vec[u].size(); ++i )
        if( vec[u][i] == v ) return 0;
    return 1;
}
void get( int u )
{
    int cnt = 0;
    set<int>::iterator it = st.begin();
    while( it != st.end() ){
        vv[u].push_back( *it );
        it++;
        cnt++;
        if( cnt > 10 ) break;
    }
}
int dfs( int dep, int u )
{
    if( dep == m ){
        return 1;
    }
    st.erase( u );

    int v;
    get( u );
    for( int i = 0; i < vv[u].size(); ++i ){
        v = vv[u][i];
        if( can( u, v ) && dfs( dep+1, v ) ) return 1;
    }

    if( n == m && dep == n-1 ){
        if( can( u, 1 ) ){
            x[dep] = u, y[dep] = 1;
            return 1;
        }
    }
    st.insert( u );
    return 0;
}

bool check()
{
    for( int i = 1; i <= n; ++i ) st.insert( i );
    //int u = 1;

    return dfs( 0, 1 );
}
int main()
{
   // #ifndef ONLINE_JUDGE
    //    freopen( "a.in", "r", stdin );
   // #endif // ONLINE_JUDGE
    cin>>n>>m;
    int u, v;
    for( int i = 0; i < m; ++i ){
        scanf( "%d%d", &u, &v );
        vec[u].push_back( v );
        vec[v].push_back( u );
    }
    if( check() ){
        for( int i = 0; i < m; ++i ) printf( "%d %d\n", x[i], y[i] );
    }
    else puts( "-1" );
}


#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<map>
#include<stack>
#include<queue>
#include<cmath>
#include<vector>
#include<cstring>
#include<string>
#include<limits>
#include<set>

using namespace std;

#define M 100010
#define N 1010
#define mod 1000000007
#define pi acos(-1.0)
#define inf (1<<30)
#define ls p<<1
#define rs p<<1|1
//#pragma comment(linker, "/STACK:102400000")
typedef long long ll;

int n, m;
vector<int> vec[M];
vector<int> vv[M];
int x[M], y[M];
int in[M];
bool check()
{
    int cnt = 0;
    queue<int> q;
    for( int i = 1; i <= n; ++i ) q.push( i );

    int u, v;
    for( int i = 1; i <= n; ++i )if( in[i] < 2 ){
        for( int j = 0; !q.empty() && j < 10; ++j ){
            v = q.front(); q.pop();
            if( in[v] >= 2 ) continue;
            if( v == i ){
                q.push( v );
                continue;
            }
            int c = 0;
            for( int l = 0; l < vec[i].size(); ++l )
                if( i == v || vec[i][l] == v ){
                    c = 1;
                    if( in[v] < 2 )
                        q.push( v );
                    break;
                }
            for( int l = 0; l < vv[i].size(); ++l )
                if( i == v || vv[i][l] == v ){
                    c = 1;
                    if( in[v] < 2 )
                        q.push( v );
                    break;
                }

            if( c ) continue;
            in[i]++;
            in[v]++;
            vv[i].push_back( v );
            vv[v].push_back( i );
            x[cnt] = i, y[cnt++] = v;
            if( cnt == m ) return 1;
            if( in[v] < 2 ) q.push( v );
            if( in[i] == 2 ) break;
        }
    }
    return 0;
}
int main()
{
   // #ifndef ONLINE_JUDGE
    //    freopen( "a.in", "r", stdin );
   // #endif // ONLINE_JUDGE
    cin>>n>>m;
    int u, v;
    for( int i = 0; i < m; ++i ){
        scanf( "%d%d", &u, &v );
        vec[u].push_back( v );
        vec[v].push_back( u );
    }
    if( check() ){
        for( int i = 0; i < m; ++i ) printf( "%d %d\n", x[i], y[i] );
    }
    else puts( "-1" );
}


#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<map>
#include<stack>
#include<queue>
#include<cmath>
#include<vector>
#include<cstring>
#include<string>
#include<limits>
#include<set>

using namespace std;

#define M 100010
#define N 1010
#define mod 1000000007
#define pi acos(-1.0)
#define inf (1<<30)
#define ls p<<1
#define rs p<<1|1
//#pragma comment(linker, "/STACK:102400000")
typedef long long ll;

int n, m;
vector<int> vec[M];
vector<int> vv[M];
int x[M], y[M];
set<int> st;

bool can( int u, int v )
{
    for( int i = 0; i < vec[u].size(); ++i )
        if( vec[u][i] == v ) return 0;
    return 1;
}
void get( int u )
{
    int cnt = 0;
    set<int>::iterator it = st.begin();
    while( it != st.end() ){
        vv[u].push_back( *it );
        it++;
        cnt++;
        if( cnt > 10 ) break;
    }
}
int dfs( int dep, int u )
{
    if( dep == m ){
        return 1;
    }
    st.erase( u );

    int v;
    get( u );
    for( int i = 0; i < vv[u].size(); ++i ){
        v = vv[u][i];
        x[dep] = u, y[dep] = v;
        if( can( u, v ) && dfs( dep+1, v ) ) return 1;
    }

    if( n == m && dep == n-1 ){
        if( can( u, 1 ) ){
            x[dep] = u, y[dep] = 1;
            return 1;
        }
    }
    st.insert( u );
    return 0;
}

bool check()
{
    for( int i = 1; i <= n; ++i ) st.insert( i );
    //int u = 1;

    return dfs( 0, 1 );
}
int main()
{
   // #ifndef ONLINE_JUDGE
    //    freopen( "a.in", "r", stdin );
   // #endif // ONLINE_JUDGE
    cin>>n>>m;
    int u, v;
    for( int i = 0; i < m; ++i ){
        scanf( "%d%d", &u, &v );
        vec[u].push_back( v );
        vec[v].push_back( u );
    }
    if( check() ){
        for( int i = 0; i < m; ++i ) printf( "%d %d\n", x[i], y[i] );
    }
    else puts( "-1" );
}