#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N,M;
cin>>N>>M;
vector<vector<int>>g(N+1);
for(int i=0;i<M;i++){
int a,b;
cin>>a>>b;
g[a].push_back(b);
g[b].push_back(a);
}
vector<tuple<int,int,int,int>>c;
for(int i=1;i<=N;i++){
vector<int>v(N+1);
v[i]=-1;
for(int j:g[i]){
v[j]=-1;
}
for(int j:g[i]){
for(int k:g[j]){
if(v[k]<0){
continue;
}
if(v[k]>0){
c.emplace_back(i,j,v[k],k);
continue;
}
v[k]=j;
}
}
}
for(auto[a,b,aa,bb]:c){
vector<int>v(N+1,-1);
vector<vector<pair<int,int>>>w(2);
auto dfs=[&](auto self,int i)->void{
for(int j:g[i]){
if(v[j]!=-1){
continue;
}
v[j]=v[i];
self(self,j);
w[v[i]].emplace_back(i,j);
}
};
v[a]=0;
v[b]=1;
v[aa]=0;
v[bb]=1;
dfs(dfs,aa);
dfs(dfs,bb);
if(count(v.begin(),v.end(),-1)==1){
vector<pair<int,int>>s;
for(auto[a,b]:w[0]){
s.emplace_back(a,b);
}
for(auto[a,b]:w[1]){
s.emplace_back(a,b);
}
s.emplace_back(a,aa);
s.emplace_back(b,bb);
s.emplace_back(a,b);
s.emplace_back(aa,bb);
reverse(w[0].begin(),w[0].end());
reverse(w[1].begin(),w[1].end());
for(auto[a,b]:w[0]){
s.emplace_back(a,b);
}
for(auto[a,b]:w[1]){
s.emplace_back(a,b);
}
cout<<s.size()<<'\n';
for(auto[a,b]:s){
cout<<a<<' '<<b<<'\n';
}
return 0;
}
}
int a=1,b=g[1][0];
vector<int>v(N+1,-1);
vector<vector<pair<int,int>>>w(2);
auto dfs=[&](auto self,int i)->void{
for(int j:g[i]){
if(v[j]!=-1){
continue;
}
v[j]=v[i];
self(self,j);
w[v[i]].emplace_back(i,j);
}
};
v[a]=0;
v[b]=1;
dfs(dfs,a);
dfs(dfs,b);
vector<pair<int,int>>s;
for(auto[a,b]:w[0]){
s.emplace_back(a,b);
}
for(auto[a,b]:w[1]){
s.emplace_back(a,b);
}
s.emplace_back(a,b);
reverse(w[0].begin(),w[0].end());
reverse(w[1].begin(),w[1].end());
for(auto[a,b]:w[0]){
s.emplace_back(a,b);
}
for(auto[a,b]:w[1]){
s.emplace_back(a,b);
}
cout<<s.size()<<'\n';
for(auto[a,b]:s){
cout<<a<<' '<<b<<'\n';
}
return 0;
}