無向圖
#include<bits/stdc++.h>
#define for1(i,a,b) for( int i=(a);i<=(b);i++)
#define for2(i,a,b) for( int i=(a);i<(b);i++)
#define for3(i,a,b) for( int i=(a);i>=(b);i--)
#define for4(i,a,b) for( int i=(a);i>(b);i--)
#define mx(a,b) max(a,b)
#define mn(a,b) min(a,b)
#define puba push_back
#define mem(a) memset((a),0,sizeof((a)))
using namespace std;
int x,y;
int rd(int l,int r){
mt19937 rnd(random_device{}());
return rnd()%(r-l+1)+l;
}
struct node{
int l,r;
bool operator < (const node &g) const{
if(l==g.l) return r<g.r;
return l<g.l;
}
};
map<node,int>mp;
int main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
freopen("make.in","w",stdout);
srand(time(0));
int n=5,m=10,k=rd(1,n/2);
cout<<n<<" "<<m<<"\n";
for1(i,2,n){
cout<<(x=rd(1,i-1))<<" "<<(y=i)<<"\n";
mp[{x,y}]=mp[{y,x}]=1;
}
for1(i,n,m){
x=rd(1,n),y=rd(1,n);
while(mp[{x,y}]||(x==y)){
x=rd(1,n),y=rd(1,n);
}
mp[{x,y}]=mp[{y,x}]=1;
cout<<x<<" "<<y<<"\n";
}
return 0;
}