#include <iostream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <functional>
#include <complex>
#include <queue>
#include <stack>
#include <cmath>
#include <cassert>
#include <tuple>
using namespace std;
typedef long long LL;
typedef complex<double> CMP;

class MakingRegularGraph { public:
	vector <int> addEdges(int n, vector <int> x, vector <int> y)
	{
		vector<int> deg(n);
		for (int i = 0; i < x.size(); ++i)
			deg[x[i]]++, deg[y[i]]++;

		set<int> d0, d1;
		for (int v = 0; v < n; ++v)
			if (deg[v] == 0) d0.insert(v);
			else if (deg[v] == 1) d1.insert(v);
		map<int, int> d1e;
		for (int i = 0; i < x.size(); ++i)
			if (d1.count(x[i]) && d1.count(y[i])) {
				d1e[x[i]] = y[i];
				d1e[y[i]] = x[i];
				d1.erase(x[i]);
				d1.erase(y[i]);
			}

		#define BAD (((d0.size()==1||d0.size()==2) && d1.empty() && d1e.empty()) || (d0.empty() && d1.empty() && d1e.size()==2 && d1e.begin()->first==d1e.rbegin()->second))
		if(BAD)
			return vector<int>(1, -1);

		vector<bool> used(n*n);
		for (int i = 0; i < x.size(); ++i)
			used[x[i] * n + y[i]] = true;

		vector<int> ans;
		for(int v=0; v<n; ++v)
		for(int u=v+1; u<n; ++u) if(!used[v*n+u])
		{
			if (d0.empty() && d1.empty() && d1e.empty())
				break;

			bool bad = true;
			if (d0.count(v)) {
				d0.erase(v);
				if (d0.count(u)) {
					d0.erase(u);
					d1e[v] = u;
					d1e[u] = v;
					if (bad=BAD) {
						d0.insert(u);
						d1e.erase(v);
						d1e.erase(u);
					}
				}
				else if (d1.count(u)) {
					d1.erase(u);
					d1.insert(v);
					if (bad = BAD) {
						d1.insert(u);
						d1.erase(v);
					}
				}
				else if (d1e.count(u)) {
					int ut = d1e[u]; d1e.erase(u);
					d1.insert(v);
					if (bad = BAD) {
						d1e[u] = ut;
						d1.erase(v);
					}
				}
				if (bad)
					d0.insert(v);
			}
			else if (d1.count(v)) {
				d1.erase(v);
				if (d0.count(u)) {
					d0.erase(u);
					d1.insert(u);
					if (bad = BAD) {
						d0.insert(u);
						d1.erase(u);
					}
				}
				else if (d1.count(u)) {
					d1.erase(u);
					if (bad = BAD) {
						d1.insert(u);
					}
				}
				else if (d1e.count(u)) {
					int ut = d1e[u]; d1e.erase(u);
					if (bad = BAD) {
						d1e[u] = ut;
					}
				}
				if (bad)
					d1.insert(v);
			}
			else if (d1e.count(v)) {
				int vt = d1e[v];  d1e.erase(v);
				if (d0.count(u)) {
					d0.erase(u);
					d1.insert(u);
					if (bad = BAD) {
						d0.insert(u);
						d1.erase(u);
					}
				}
				else if (d1.count(u)) {
					d1.erase(u);
					if (bad = BAD) {
						d1.insert(u);
					}
				}
				else if (d1e.count(u)) {
					int ut = d1e[u]; d1e.erase(u);
					if (bad = BAD) {
						d1e[u] = ut;
					}
				}
				if (bad)
					d1e[v] = vt;
			}

			if(!bad)
				ans.push_back(v), ans.push_back(u);
		}

		return ans;
	}
};

// BEGIN CUT HERE
#include <ctime>
double start_time; string timer()
 { ostringstream os; os << " (" << int((clock()-start_time)/CLOCKS_PER_SEC*1000) << " msec)"; return os.str(); }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v)
 { os << "{ ";
   for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
   os << '\"' << *it << '\"' << (it+1==v.end() ? "" : ", "); os << " }"; return os; }
void verify_case(const vector <int>& Expected, const vector <int>& Received) {
 bool ok = (Expected == Received);
 if(ok) cerr << "PASSED" << timer() << endl;  else { cerr << "FAILED" << timer() << endl;
 cerr << "\to: " << Expected << endl << "\tx: " << Received << endl; } }
#define CASE(N) {cerr << "Test Case #" << N << "..." << flush; start_time=clock();
#define END	 verify_case(_, MakingRegularGraph().addEdges(n, x, y));}
int main(){

CASE(0)
	int n = 6; 
	int x_[] = {0,2};
	  vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_)); 
	int y_[] = {2,3};
	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_)); 
	int __[] = {0, 1, 1, 4, 3, 5, 4, 5 };
	  vector <int> _(__, __+sizeof(__)/sizeof(*__)); 
END
CASE(1)
	int n = 4; 
	int x_[] = {1,2,1};
	  vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_)); 
	int y_[] = {2,3,3};
	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_)); 
	int __[] = {-1 };
	  vector <int> _(__, __+sizeof(__)/sizeof(*__)); 
END
CASE(2)
	int n = 3; 
	vector <int> x; 
	vector <int> y; 
	int __[] = {0, 1, 0, 2, 1, 2 };
	  vector <int> _(__, __+sizeof(__)/sizeof(*__)); 
END
CASE(3)
	int n = 5; 
	int x_[] = {0};
	  vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_)); 
	int y_[] = {4};
	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_)); 
	int __[] = {0, 1, 1, 2, 2, 3, 3, 4 };
	  vector <int> _(__, __+sizeof(__)/sizeof(*__)); 
END
CASE(4)
	int n = 5; 
	int x_[] = {2};
	  vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_)); 
	int y_[] = {3};
	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_)); 
	int __[] = {0, 1, 0, 2, 1, 4, 3, 4 };
	  vector <int> _(__, __+sizeof(__)/sizeof(*__)); 
END
/*
CASE(5)
	int n = ; 
	int x_[] = ;
	  vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_)); 
	int y_[] = ;
	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_)); 
	int __[] = ;
	  vector <int> _(__, __+sizeof(__)/sizeof(*__)); 
END
CASE(6)
	int n = ; 
	int x_[] = ;
	  vector <int> x(x_, x_+sizeof(x_)/sizeof(*x_)); 
	int y_[] = ;
	  vector <int> y(y_, y_+sizeof(y_)/sizeof(*y_)); 
	int __[] = ;
	  vector <int> _(__, __+sizeof(__)/sizeof(*__)); 
END
*/
}
// END CUT HERE
