#include <stdio.h>
#define MAX 100
typedef struct {
int A[MAX][MAX];
int n;
} Graph;
void init_graph(Graph *pG, int n) {
pG->n = n;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
pG->A[i][j] = 0;
}
void add_edge(Graph *pG, int x, int y) {
pG->A[x][y] = 1;
pG->A[y][x] = 1;
}
int mark[MAX];
int parent[MAX];
void depth_first_search(Graph *pG, int u) {
mark[u] = 1;
for (int v = 1; v <= pG->n; v++)
if (pG->A[u][v] != 0 && mark[v] == 0) {
parent[v] = u;
depth_first_search(pG, v);
}
}
int main() {
Graph G;
int n, m, u, v;
scanf("%d%d", &n, &m);
init_graph(&G, n);
for (int i = 1; i <= m; i++) {
scanf("%d%d", &u, &v);
add_edge(&G, u, v);
}
for (int i = 1; i <= n; i++)
mark[i] = 0;
int connected = 1;
for (int i = 1; i <= n; i++)
if (mark[i] == 0) {
if (i > 1) {
connected = 0;
break;
}
depth_first_search(&G, i);
}
if (!connected) {
printf("-1\n");
return 0;
}
for (int i = 1; i <= n; i++)
if (parent[i] != 0)
printf("%d %d\n", parent[i], i);
return 0;
}