// Fresh Peach Heart Shower
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define MP std::make_pair
#define ALL(x) (x).begin(),(x).end()
#define mem(x,y) memset(x,y,sizeof(x))
#ifdef _LOCAL_
#define dprintf(x...) fprintf(stderr,x)
#else
#define dprintf(x...) 42
#endif
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,b,a) for(int i=(b);i>=(a);--i)
typedef std::vector<int > poly;
typedef std::pair<int,int > pii;
void setIn(std::string s){freopen(s.c_str(),"r",stdin);}
void setOut(std::string s){freopen(s.c_str(),"w",stdout);}
void setIO(std::string s){setIn(s+".in"),setOut(s+".out");}
template <class t> inline bool ckmin(t&x,t y){if(x>y)return x=y,1;return 0;}
template <class t> inline bool ckmax(t&x,t y){if(x<y)return x=y,1;return 0;}
inline int lowbit(int x){return x&(-x);}
std::random_device RDS;
std::mt19937_64 rnd(RDS());
int getrand(int l,int r)
{
	assert(l<=r);
	return rnd()%(r-l+1)+l;
}
signed main(void)
{
#ifndef _LOCAL_
	std::ios::sync_with_stdio(false),std::cin.tie(0);
#endif
	
	setOut("barrack.in");

	int n=5e5,m=1e6;
	std::cout<<n<<' '<<m<<'\n';
	std::map<pii ,int > vis;
	rep(i,1,n-1)
	{
		int x=getrand(1,i);
		int y=i+1;
		std::cout<<x<<' '<<y<<'\n';
		vis[MP(x,y)],vis[MP(y,x)];
	}
	m-=n-1;
	while(m--)
	{
		int x,y;
		do
		{
			x=getrand(1,n),y=getrand(1,n);
		}while(x==y||vis[MP(x,y)]);
		vis[MP(x,y)]=1,vis[MP(y,x)]=1;
		std::cout<<x<<' '<<y<<'\n';
	}
	return 0;
}


