class Bridge:
    def __init__(self, nodeA, nodeB):
        self.edges = [BridgeEdge(nodeA, self), BridgeEdge(nodeB, self)]
        nodeA.addEdge(self.edges[1])
        nodeB.addEdge(self.edges[0])
        self.dir = True
        self.vec = None

class BridgeEdge:
    def __init__(self, node, edge):
        self.edge = edge
        self.node = node
    def another(self):
        return self.edge.edges[1 if self.edge.edges[0] == self else 0]

class Node:
    def __init__(self, id):
        self.id = id
        self.bridges = []
        self.parent = None
        self.judge = 0
    def addEdge(self, bridgeEdge):
        self.bridges.append(bridgeEdge)
    def __repr__(self):
        return str((self.id, None if self.parent is None else self.parent.node.id))

N, M = map(int, input().split())

nodes = [Node(i) for i in range(N+1)]
bridges = []
for A, B in (map(int, input().split()) for _ in range(N)):
    bridges.append(Bridge(nodes[A], nodes[B]))

s = [(None, nodes[1])]
idx = 0
ok = True
while idx < len(s):
    pre, cur = s[idx]
    idx += 1


    for nxt in cur.bridges:
        if nxt.node.judge <= 0:
            nxt.node.parent = nxt.another()
            cur.judge += 1
            nxt.edge.vec = (cur.id, nxt.node.id)
            s.append((cur, nxt.node))


    if cur.judge % 2 == 1:
        ok = not ok
        wrk = cur
        while wrk.parent is not None:
            br = wrk.parent.edge
            br.dir = not br.dir
            wrk = wrk.parent.node

if ok:
    for br in bridges:
        if br.dir:
            print("{} {}".format(br.vec[1], br.vec[0]))
        else:
            print("{} {}".format(br.vec[0], br.vec[1]))
else:
    print("-1")
