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")


### FIXED CODE ###

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
    def __repr__(self):
        return str((self.vec, self.dir))

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 = True
    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, self.judge))

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(M)):
    bridges.append(Bridge(nodes[A], nodes[B]))

s = [(0, nodes[1])]
idx = 0
while len(s) > 0:
    level, cur = s.pop()

    nxtlevel = level + 1
    for nxt in cur.bridges:
        if nxt.edge.vec is None:
            cur.judge ^= True
            nxt.edge.vec = (cur.id, nxt.node.id)
            if nxt.node.parent is None:
                nxt.node.parent = nxt.another()
                s.append((nxtlevel, nxt.node))

    if len(s) > 0:
        nl = s[-1][0]
    else:
        nl = 1
    while level >= nl:
        if not cur.judge:
            cur.judge ^= True
            cur.parent.node.judge ^= True
            cur.parent.edge.dir ^= True
        level -= 1
        cur = cur.parent.node
  
if all(node.judge for node in nodes[1:]):
    for br in bridges:
        if br.dir:
            print("{} {}".format(br.vec[0], br.vec[1]))
        else:
            print("{} {}".format(br.vec[1], br.vec[0]))
else:
    print("-1")