#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        std::cin.tie(0);
        ios::sync_with_stdio(false);
        cout.precision(20);
    }
} fast;

/* define */
#define FOR(I, X, Y) for (long long(I) = (X); (I) < (Y); (I)++)
#define REP(I, X, Y) for (long long(I) = (Y)-1; (I) >= (X); (I)--)
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define COUNT(V, X)                           \
    (upper_bound((V).begin(), (V).end(), X) - \
     lower_bound((V).begin(), (V).end(), X))
#define debug(x) cerr << #x << ':' << x << endl;
#define DEBUG(v)                             \
    {                                        \
        cerr << #v << ':';                   \
        for (auto xv : v) cerr << xv << ' '; \
        cerr << endl;                        \
    }
#define Yes(X) cout << (X ? "Yes" : "No") << endl;
#define YES(X) cout << (X ? "YES" : "NO") << endl;
#define ctoi(C) (C - '0')
#define pow2(x) ((long long)((long long)1 << x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int, int>;
using pl = pair<long long, long long>;
template <typename T>
using PQ = priority_queue<T>;
template <typename T>
using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1, 0, -1, 0};
const long long dy[] = {0, 1, 0, -1};
const long long dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const long long dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const long long dx9[] = {1, 1, 0, -1, -1, -1, 0, 1, 0};
const long long dy9[] = {0, 1, 1, 1, 0, -1, -1, -1, 0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) a = b;
    return a > b;
}
template <typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) a = b;
    return a < b;
}
long long max(long long x, int y) {
    return max(x, (long long)y);
}
long long max(int x, long long y) {
    return max((long long)x, y);
}
long long min(long long x, int y) {
    return min(x, (long long)y);
}
long long min(int x, long long y) {
    return min((long long)x, y);
}

/* library */

/* main */

signed main() {
    ll N, M;
    cin >> N >> M;
    vl A(M), B(M);
    vector<vl> adj;
    adj.resize(N);
    map<pair<int, int>, int> index_of_edge;
    bool rev[M] = {};
    bool odd[N] = {};
    FOR(i, 0, M) {
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
        adj[A[i]].push_back(B[i]);
        adj[B[i]].push_back(A[i]);
        odd[A[i]] = !odd[A[i]];
        index_of_edge[make_pair(A[i], B[i])] = i;
        index_of_edge[make_pair(B[i], A[i])] = i;
    }
    if (M % 2) {
        cout << "-1" << endl;
        return 0;
    }
    ll bfs[N] = {};
    queue<int> que;
    que.push(0);
    bfs[0] = 1;
    while (que.size()) {
        ll f = que.front();
        que.pop();
        for (auto x : adj[f]) {
            if (!bfs[x]) {
                bfs[x] = bfs[f] + 1;
                que.push(x);
            }
        }
    }

    priority_queue<pair<int, int>> pque;
    FOR(i, 0, N) {
        pque.push(make_pair(bfs[i], i));
    }

    while (pque.size()) {
        auto p = pque.top();
        pque.pop();
        if (odd[p.second]) {
            for (auto x : adj[p.second]) {
                if (bfs[x] < bfs[p.second]) {
                    auto idx = index_of_edge[make_pair(x, p.second)];
                    rev[idx] = !rev[idx];
                    odd[x] = !odd[x];
                    odd[p.second] = !odd[p.second];
                    break;
                }
            }
            assert(!odd[p.second]);
        }
    }

    FOR(i, 0, M) {
        if (rev[i]) {
            cout << B[i] + 1 << ' ' << A[i] + 1 << endl;
        } else {
            cout << A[i] + 1 << ' ' << B[i] + 1 << endl;
        }
    }
}

Measured memory_bytes: 23416