func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<int> g[100005];   int n, m;   vector<int> c[100005];   int nc;   bool b[100005];   int v[100005];   vector<pair<int, int> > e;   int s0[100005], s1[100005];   int w[100005];   void add(int x, int y) {     e.push_back(make_pair(x, y));     if (((int)e.size()) == m) {       for (auto p : e) printf( %d %d n , p.first + 1, p.second + 1);       exit(0);     }   }   void add2(int i, int j) {     add(i, j);     if (s0[j] == s0[i])       s0[s0[i]] = -1, s0[i] = s0[j] = s1[i] = s1[j] = -1;     else {       s1[s0[i]] = s1[s0[j]];       s0[s0[j]] = s0[s0[i]];     }     n--;   }   void dfs(int x) {     if (v[x] >= 0) return;     v[x] = nc;     c[nc].push_back(x);     for (int y : g[x]) dfs(y);   }   priority_queue<pair<int, int> > q;   int main() {     scanf( %d%d , &n, &m);     for (int _ = 0, ThxDem = m; _ < ThxDem; ++_) {       int x, y;       scanf( %d%d , &x, &y);       x--;       y--;       g[x].push_back(y);       g[y].push_back(x);     }     memset(v, -1, sizeof(v));     for (int i = 0, ThxDem = n; i < ThxDem; ++i)       if (!((int)g[i].size())) b[nc] = true, v[i] = nc, c[nc++] = {i};     for (int i = 0, ThxDem = n; i < ThxDem; ++i)       if (((int)g[i].size()) == 1 && v[i] < 0) dfs(i), b[nc++] = false;     for (int i = 0, ThxDem = n; i < ThxDem; ++i)       if (v[i] < 0) dfs(i), b[nc++] = true;     if (nc == 1) {       if (n >= 5)         for (int i = 0, ThxDem = n; i < ThxDem; ++i)           add(c[0][i], c[0][(i + 2) % n]);       else if (n == 4 && !b[0]) {         add(c[0][1], c[0][3]);         add(c[0][3], c[0][0]);         add(c[0][0], c[0][2]);         assert(0);       }     } else {       for (int i = 0, ThxDem = n; i < ThxDem; ++i) s0[i] = s1[i] = i;       pair<int, int> t = make_pair(-1, -1);       for (int i = 0, ThxDem = nc; i < ThxDem; ++i)         t = max(t, make_pair(((int)c[i].size()), i));       int k = t.second;       if (((int)c[k].size()) > n - ((int)c[k].size())) {         if (((int)c[k].size()) == 2) {           add(c[k][0], c[k ^ 1][0]);           assert(0);         }         if (((int)c[k].size()) == 3) {           if (!b[k]) add2(c[k][0], c[k][2]);         } else if (((int)c[k].size()) == 4 && b[k]) {           add2(c[k][0], c[k][2]);           if (((int)c[k].size()) - 1 > n - (((int)c[k].size()) - 1))             add2(c[k][1], c[k][3]);         } else if (((int)c[k].size()) == 4) {           add2(c[k][1], c[k][3]);           if (((int)c[k].size()) - 1 > n - (((int)c[k].size()) - 1)) {             add2(c[k][3], c[k][0]);             if (((int)c[k].size()) - 2 > n - (((int)c[k].size()) - 2))               add2(c[k][0], c[k][2]);           }         } else {           for (int i = 0, ThxDem = ((int)c[k].size()); i < ThxDem; ++i) {             add2(c[k][i], c[k][(i + 2) % ((int)c[k].size())]);             if (((int)c[k].size()) - i - 1 <= n - (((int)c[k].size()) - i - 1))               break;           }         }         vector<int> t;         for (int x : c[k])           if (s0[x] == x) t.push_back(x);         c[k] = t;       }       int l = -1;       for (int i = 0, ThxDem = nc; i < ThxDem; ++i)         q.push(make_pair(((int)c[i].size()), i == k ? i : -i));       while (!q.empty()) {         auto p = q.top();         q.pop();         int i = abs(p.second);         if (l >= 0 && v[l] == i) {           if (q.empty()) break;           auto qwe = p;           p = q.top();           q.pop();           q.push(qwe);           i = abs(p.second);         }         if (l >= 0) add(s1[l], s0[c[i][w[i]]]);         l = c[i][w[i]++];         if (p.first > 1) q.push(make_pair(p.first - 1, i == k ? i : -i));       }       if (v[l] != k) {         add(s1[l], s0[c[k][0]]);       }     }     puts( -1 );     return 0;   }   