#include<bits/stdc++.h>
using namespace std;
int n,m;
int a[151][151];
int u,v;
bool c[151];
bool g=false;
void dfs(int t){
if(t==n){
g=true;
return;
}
for(int i=1;i<=n;i++){
if(a[t][i]==1&&a[i][t]==1&&c[i]==false){
c[i]=true;
dfs(i);
}
}
}
int main(){
cin>>n>>m;
for(int i=1;i<=m;i++){
cin>>u>>v;
a[u][v]=1;
a[v][u]=1;
}
for(int i=1;i<n;i++){
for(int j=i+1;j<=n;j++){
for(int k=1;k<=n;k++){
c[k]=false;
}
if(a[i][j]==1){
g=false;
a[i][j]=0;
a[j][i]=0;
dfs(1);
if(g==false){
if(i>j){
int y=j;
j=i;
i=y;
}
cout<<i<<" "<<j<<"\n";
}
a[i][j]=1;
a[j][i]=1;
}
}
}
return 0;
}
#3 20分