Language: C++

    #pragma GCC optimize("Ofast")
    #pragma GCC optimize("no-stack-protector")
    #pragma GCC optimize("unroll-loops")
    #pragma GCC optimize("fast-math")
    #pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
    #include <iostream>
    #include <vector>
    #include <algorithm>
    #include <set>
    #include <map>
    #include <unordered_set>
    #include <unordered_map>
    #include <stdio.h>
    #include <cstdio>
    #include <math.h>
    #include <cmath>
    #include <string>
    #include <cstring>
    #include <queue>
    #include <deque>
    #include <random>
    #include <iomanip>
    #include <bitset>
                            
    using namespace std;
                            
    template<typename T> void uin(T &a, T b) {
        if (b < a) {
            a = b;
        }
    }
                            
    template<typename T> void uax(T &a, T b) {
        if (b > a) {
            a = b;
        }
    }
     
     
    #define int long long
    #define ghost signed
    #define left left228
    #define right right228
    #define prev prev228
    #define list list228
     
    const int N = 100 * 1000 + 228;
     
    namespace DSU
    {
    	int p[N], sz[N];
     
    	void init(int n) {
    		for (int i = 1; i <= n; ++i) {
    			p[i] = i;
    			sz[i] = 1;
    		}
    	}
     
    	int getp(int v) {
    		if (v == p[v]) return v;
    		p[v] = getp(p[v]);
    		return p[v];
    	}
     
    	bool join(int u, int v) {
    		u = getp(u);
    		v = getp(v);
    		if (u == v) return 0;
    		if (sz[u] < sz[v]) {
    			p[u] = v;
    			sz[v] += sz[u];
    		} else {
    			p[v] = u;
    			sz[u] += sz[v];
    		}
    		return 1;
    	}
    };
     
    vector<int> g[N];
    vector< pair<int, int> > ans;
    int deg[N];
     
    void dfs(int v, int par = -1) {
    	for (int to : g[v]) {
    		if (to != par) dfs(to, v);
    	}
    	if (deg[v]) {
    		ans.emplace_back(v, par);
    	} else {
    		if (par != -1) {
    			ans.emplace_back(par, v);
    			deg[par] ^= 1;
    		}
    	}
    }
     
    int a[100];
     
    ghost main() {
        ios_base::sync_with_stdio(false);
        cin.tie(0);
    	int n, m;
    	cin >> n >> m;
    	if (m & 1) {
    		cout << -1 << '\n';
    		return 0;
    	}
    	DSU::init(n);
    	for (int i = 0; i < m; ++i) {
    		int u, v;
    		cin >> u >> v;
    		if (DSU::join(u, v)) {
    			g[u].push_back(v);
    			g[v].push_back(u);
    		} else {
    			ans.emplace_back(u, v);
    			deg[u] ^= 1;
    		}
    	}
    	dfs(1);
    	for (auto p : ans) cout << p.first << ' ' << p.second << '\n';
        return 0;
    } // kek ;

Compiler output:
In file included from /usr/include/c++/14/string:43,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:6:
/usr/include/c++/14/bits/allocator.h: In destructor 'std::_Vector_base<long long int, std::allocator<long long int> >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/14/bits/allocator.h:182:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = long long int]': target specific option mismatch
  182 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/14/vector:66,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_vector.h:132:14: note: called from here
  132 |       struct _Vector_impl
      |              ^~~~~~~~~~~~