let readInt () = Scanf.scanf " %d" (fun x -> x)

type graph = {n: int; m: int; e: (int * int) array; adj: (int list) array}
type spanningTree = {root: int; p: int array; ch: (int list) array}

let fullRep (n, m, e0) : graph = let res = {
  n;
  m;
  e=Array.init (2*m) (fun i ->
    let (u, v) = e0.(i/2) in
    if i mod 2 = 0 then (u, v)
    else (v, u))
  ;
  adj=
    let adj = Array.make n [] in
    for i=0 to m-1 do
      let (u, v) = e0.(i) in
      adj.(u) <- (2*i) :: adj.(u);
      adj.(v) <- (2*i+1) :: adj.(v)
    done;
    adj
}
in
Array.iteri (fun u is -> List.iter (fun i -> let (u', v) = res.e.(i) in assert (u' = u); assert (List.mem (i lxor 1) res.adj.(v))) is) res.adj;
for i=0 to 2*m-1 do
  let (u, v) = res.e.(i) in
  assert (res.e.(i lxor 1) = (v, u))
done;
res

let root (rt : int) ({n; e; adj} : graph) : spanningTree =
  let p = Array.make n (-1) in
  let ch = Array.make n [] in
  let vis = Array.make n false in
  let rec go u i =
    vis.(u) <- true;
    p.(u) <- i;
    List.iter
      (fun j ->
        let (_, v) = e.(j) in
        if not vis.(v) then begin
          ch.(u) <- j :: ch.(u);
          go v (j lxor 1)
        end)
      adj.(u)
  in
  go rt (-1);
  Array.iteri (fun u is -> List.iter (fun i -> let (u', v) = e.(i) in assert (u' = u); assert (p.(v) = (i lxor 1))) is) ch;
  {root=rt; p; ch}

type edgeSet = {h: (int, unit) Hashtbl.t; outDeg: bool array}
let addEdge s g i =
  Hashtbl.add s.h i ();
  let (u, _) = g.e.(i) in s.outDeg.(u) <- not s.outDeg.(u)

let solve (g : graph) : (edgeSet option) =
  if g.m mod 2 = 1 then None
  else
  let t = root 0 g in
  let te = Hashtbl.create (g.n-1) in
  let rec dfs u =
    List.iter
      (fun i ->
        Hashtbl.add te (i/2) ();
        let (_, v) = g.e.(i) in dfs v)
      t.ch.(u)
  in
  dfs 0;
  let inTree i = Hashtbl.mem te i in
  let ans = {h=Hashtbl.create g.m; outDeg = Array.make g.n false} in
  for i=0 to g.m-1 do
    if not (inTree i) then addEdge ans g (2*i)
  done;
  let rec dp u =
    List.iter
      (fun i ->
        let (_, v) = g.e.(i) in
        dp v;
        if ans.outDeg.(v) then addEdge ans g (i lxor 1)
        else addEdge ans g i)
      t.ch.(u)
  in
  dp 0;
  assert (not ans.outDeg.(0));
  Some ans

let main () =
  let n = readInt () in
  let m = readInt () in
  let e0 = Array.init m (fun _ -> (readInt () - 1, readInt () - 1)) in
  let g = fullRep (n, m, e0) in
  match solve g with
    | None -> Printf.printf "-1\n"
    | Some es ->
        Hashtbl.iter
          (fun i () ->
            let (u, v) = g.e.(i) in
            Printf.printf "%d %d\n" (u+1) (v+1))
          es.h

let () = main ()
