import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, std.bitmanip;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto G = new Tuple!(int, int)[][](N);
    auto E = new Tuple!(int, int)[](M);
    auto deg = new int[](N);
    foreach (i; 0..M) {
        s = readln.split.map!(to!int);
        auto u = s[0] - 1;
        auto v = s[1] - 1;
        G[u] ~= tuple(v, i);
        G[v] ~= tuple(u, i);
        E[i] = tuple(u, v);
        deg[u] ^= 1;
    }

    if (M % 2 == 1) {
        writeln(-1);
        return;
    }

    auto used = new bool[](N);
    auto H = new Tuple!(int, int)[][](N);

    void dfs1(int n) {
        if (used[n]) return;
        used[n] = true;
        foreach (to; G[n]) {
            int m = to[0];
            int idx = to[1];
            if (used[m]) continue;
            H[n] ~= tuple(m, idx);
            H[m] ~= tuple(n, idx);
            dfs1(m);
        }
    }
    dfs1(0);

    int dfs2(int n, int p) {
        int x = -1;
        foreach (to; H[n]) {
            int m = to[0];
            int idx = to[1];
            if (m == p) continue;
            int y = dfs2(m, n);
            if (y == 0) continue;
            if (x != -1) {
                swap(E[x][0], E[x][1]);
                swap(E[idx][0], E[idx][1]);
                x = -1;
            } else {
                x = idx;
            }
        }
        int ret = deg[n];
        if (x != -1) {
            swap(E[x][0], E[x][1]);
            ret ^= 1;
        }
        writeln(n+1, " ", ret);
        return ret;
    }
    dfs2(0, -1);

    E.each!(e => writeln(e[0]+1, " ", e[1]+1));
}