#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define initialize(array,size,value) for(ll i=0;i<size;i++) array[i]=value
#define couta(array,size) for(ll i=0;i<size;i++) cout<<array[i]<<" "
#define inf (long long int) 1e18
#define eps 0.000001
#define vl vector<ll> 
#define sl set<ll>
#define pll pair<ll, ll>
#define mll map<ll, ll> 
#define pq priority_queue<ll>
#define mod 1000000007
#define MAXN 100001
ll spf[MAXN]; 
ll gcd(ll a,ll b);
ll palindrome(string s);
ll modexp(ll a,ll b,ll m);
void sieve();
ll ceil(ll a, ll b);
vl getFactorization(ll x);
void getZarr(string str, ll Z[]);
vector<ll> prefix_function(string s);

vl adj[100005];
bool vis[100005];
ll cnt[100005];
bool edge[100005];
vl tree[100005];
ll ans[100005];
ll in[100005];
map<pll,ll> m1;
map<ll,pll> m2;
//bool edgedir[100005]={false};

void dfs(ll s){
    vis[s]=true;
    for(auto x:adj[s]){
        if(vis[x]==false){
            dfs(x);
            edge[m1[mp(x,s)]]=true;
            tree[x].pb(s), tree[s].pb(x);
        }
    }
}

void dfs2(ll s, ll e){
    //cout<<"function call for "<<s<<" "<<e<<endl;
    for(auto x:tree[s]){
        if(x!=e){
            dfs2(x,s);
            //if(s!=1 /*&& edgedir[m1[mp(s,x)]]==false*/){
                //cout<<"insideee "<<s<<" "<<x<<endl;
                if(cnt[x]%2==0){
                    if(in[x]%2==0){
                        // edge from x to s
                        in[s]++;
                        ll rr=m1[{s,x}];
                        //cout<<"case 1 "<<rr<<endl;
                        pll pp=m2[rr];
                        if(pp.fi==x) ans[rr]=0;
                        else if(pp.fi==s) ans[rr]=1;
                        //edgedir[rr]=true;
                    }
                    else {
                        //edge from s to x
                        in[x]++;
                        ll rr=m1[{x,s}];
                        //cout<<"case 2 "<<rr<<endl;
                        pll pp=m2[rr];
                        if(pp.fi==x) ans[rr]=1;
                        else if(pp.fi==s) ans[rr]=0;
                        //edgedir[rr]=true;
                    }
                }
                else {
                    if(in[x]%2==0){
                        //edge from s to x
                        in[x]++;
                        ll rr=m1[{s,x}];
                        //cout<<"case 3"<<endl;
                        pll pp=m2[rr];
                        if(pp.fi==x) ans[rr]=1;
                        else if(pp.fi==s) ans[rr]=0;
                        //edgedir[rr]=true;
                    }
                    else {
                        // edge from x to s
                        in[s]++;
                        ll rr=m1[{x,s}];
                        //cout<<"case 4"<<endl;
                        pll pp=m2[rr];
                        if(pp.fi==x) ans[rr]=0;
                        else if(pp.fi==s) ans[rr]=1;
                        //edgedir[rr]=true;
                    }
                }
            //}
        }
    }
}


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
   

    // ll t;
    // cin>>t;
    // while(t--){
        ll n,m;
        cin>>n>>m;
        /*if(m%2==1){
            cout<<-1<<endl;
        }*/
        //else {
        loop(i,1,n+1) vis[i]=false;
        loop(i,1,n+1) cnt[i]=0;
        loop(i,1,m+1) {
            edge[i]=false;
            ans[i]=-1;
        }
        loop(i,1,n+1) {
            in[i]=0;
            adj[i].clear();
            tree[i].clear();
        }
        m1.clear();
        m2.clear();
            loop(i,1,m+1){
                ll u,v;
                cin>>u>>v;
                adj[u].pb(v), adj[v].pb(u);
                m1[mp(u,v)]=m1[mp(v,u)]=i;
                m2[i]=mp(u,v);
            }

            dfs(1);

            /*loop(i,1,n+1){
                cout<<"i--> "<<i<<endl;
                for(auto x: tree[i]){
                    cout<<x<<" ";
                }
                cout<<endl;
            }*/
            loop(i,1,m+1){
                if(edge[i]==false){
                    pll p=m2[i];
                    ll x=p.fi, y=p.se;
                    if(x<y) cnt[x]++;
                    else cnt[y]++;
                }
            }
            /*cout<<"cnt: "<<endl;
            loop(i,1,n+1) cout<<cnt[i]<<" ";
            cout<<endl;*/

            /*loop(i,2,n+1){
                if(tree[i].size()==1){
                    if(cnt[i]==0){
                        //from i to upper node
                        in[tree[i][0]]++;
                        ll rr=m1[mp(i,tree[i][0])];
                        pll pp=m2[rr];
                        if(pp.fi==i){
                            ans[rr]=0;
                        }
                        else if(pp.se==i){
                            ans[rr]=1;
                        }
                    }
                    else {
                        //from upper node to i
                        in[i]++;
                        ll rr=m1[mp(i,tree[i][0])];
                        pll pp=m2[rr];
                        if(pp.fi==i){
                            ans[rr]=1;
                        }
                        else if(pp.se==i){
                            ans[rr]=0;
                        }
                    }
                    
                }
            }*/

            /*cout<<"in: "<<endl;
            loop(i,1,n+1) cout<<in[i]<<" ";
            cout<<endl;*/

            dfs2(1,0);

            loop(i,1,m+1){
                if(edge[i]==false){
                    //cout<<"ppppppppppooooo"<<endl;
                    pll ppp=m2[i];
                    //to direct edge towards smaller
                    //cout<<ppp.fi<<" llllpp "<<ppp.se<<endl;
                    if(ppp.fi<ppp.se) {
                        ans[i]=1;
                        in[ppp.fi]++;
                    }
                    else {
                        ans[i]=0;
                        in[ppp.se]++;
                    }
                }
            }

            /*cout<<"in2: "<<endl;
            loop(i,1,n+1) cout<<in[i]<<" ";
            cout<<endl;*/

            bool done=true;
            loop(i,1,n+1){
                if(in[i]%2==1){
                    done=false;
                    break;
                }
            }
            if(done==true){
                loop(i,1,m+1){
                    // cout<<ans[i]<<" ";
                    if(ans[i]==0){
                        ll x = m2[i].fi, y= m2[i].se;
                        cout<<y<<" "<<x<<endl;
                    }
                    else if(ans[i]==1){
                        ll x = m2[i].fi, y=m2[i].se;
                        cout<<x<<" "<<y<<endl;
                    }
                }
            }
            else {
                //cout<<"here "<<endl;
                cout<<-1<<endl;
            }
        //}

//     }

}


Measured memory_bytes: 44544