# -*- coding: utf-8 -*-

import numpy as np
import sys
import os

def solve():

    N, M = list(map(int, input().split()))
    graph = [[] for i in range(N)]

    for i in range(M):
        A, B = list(map(int, input().split()))
        graph[A-1].append(B-1)
        graph[B-1].append(A-1)

    result = []
    finish = [0 for i in range(N)]
    out_num = [0 for i in range(N)]

    loop = True
    while loop:
        loop = False
        for i in range(N):
            if len(graph[i]) == 0:
                continue
            if len(graph[i])==2:
                for g in graph[i]:
                    result.append([i,g])
                    graph[g].remove(i)
                    out_num[i] += 1
                else:
                    graph[i] = []
                    loop = True


    for g in graph:
        if len(g) != 0:
            print("-1")
            return

    for r in result:
        print(str(r[0]+1) + " " +str(r[1]+1))


solve()