#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
vector<long long> adj[100005];
bool vis[100005];
long long cnt[100005];
bool edge[100005];
vector<long long> tree[100005];
long long ans[100005];
long long in[100005];
map<pair<long long, long long>, long long> m1;
map<long long, pair<long long, long long> > m2;
void dfs(long long s) {
  vis[s] = true;
  for (auto x : adj[s]) {
    if (vis[x] == false) {
      dfs(x);
      edge[m1[make_pair(x, s)]] = true;
      tree[x].push_back(s), tree[s].push_back(x);
    }
  }
}
void dfs2(long long s, long long e) {
  for (auto x : tree[s]) {
    if (x != e) {
      dfs2(x, s);
      if (cnt[x] % 2 == 0) {
        if (in[x] % 2 == 0) {
          in[s]++;
          long long rr = m1[{s, x}];
          pair<long long, long long> pp = m2[rr];
          if (pp.first == x)
            ans[rr] = 0;
          else if (pp.first == s)
            ans[rr] = 1;
        } else {
          in[x]++;
          long long rr = m1[{x, s}];
          pair<long long, long long> pp = m2[rr];
          if (pp.first == x)
            ans[rr] = 1;
          else if (pp.first == s)
            ans[rr] = 0;
        }
      } else {
        if (in[x] % 2 == 0) {
          in[x]++;
          long long rr = m1[{s, x}];
          pair<long long, long long> pp = m2[rr];
          if (pp.first == x)
            ans[rr] = 1;
          else if (pp.first == s)
            ans[rr] = 0;
        } else {
          in[s]++;
          long long rr = m1[{x, s}];
          pair<long long, long long> pp = m2[rr];
          if (pp.first == x)
            ans[rr] = 0;
          else if (pp.first == s)
            ans[rr] = 1;
        }
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  for (long long i = 1; i < n + 1; i++) vis[i] = false;
  for (long long i = 1; i < n + 1; i++) cnt[i] = 0;
  for (long long i = 1; i < m + 1; i++) {
    edge[i] = false;
    ans[i] = -1;
  }
  for (long long i = 1; i < n + 1; i++) {
    in[i] = 0;
    adj[i].clear();
    tree[i].clear();
  }
  m1.clear();
  m2.clear();
  for (long long i = 1; i < m + 1; i++) {
    long long u, v;
    cin >> u >> v;
    adj[u].push_back(v), adj[v].push_back(u);
    m1[make_pair(u, v)] = m1[make_pair(v, u)] = i;
    m2[i] = make_pair(u, v);
  }
  dfs(1);
  for (long long i = 1; i < m + 1; i++) {
    if (edge[i] == false) {
      pair<long long, long long> p = m2[i];
      long long x = p.first, y = p.second;
      if (x < y)
        cnt[x]++;
      else
        cnt[y]++;
    }
  }
  dfs2(1, 0);
  for (long long i = 1; i < m + 1; i++) {
    if (edge[i] == false) {
      pair<long long, long long> ppp = m2[i];
      if (ppp.first < ppp.second) {
        ans[i] = 1;
        in[ppp.first]++;
      } else {
        ans[i] = 0;
        in[ppp.second]++;
      }
    }
  }
  bool done = true;
  for (long long i = 1; i < n + 1; i++) {
    if (in[i] % 2 == 1) {
      done = false;
      break;
    }
  }
  if (done == true) {
    for (long long i = 1; i < m + 1; i++) {
      if (ans[i] == 0) {
        long long x = m2[i].first, y = m2[i].second;
        cout << y << " " << x << '\n';
      } else if (ans[i] == 1) {
        long long x = m2[i].first, y = m2[i].second;
        cout << x << " " << y << '\n';
      }
    }
  } else {
    cout << -1 << '\n';
  }
}
