unittest
{
//	assert( [ "4 1" ].parse.expand.solve == "2 3" );
//	assert( [ "7 3" ].parse.expand.solve == "1 6\n2 5\n3 4" );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto nm = input.front.split.to!( long[] );
	return tuple( nm[ 0 ], nm[ 1 ] );
}

auto solve( long n, long m )
{
	auto anss = new long[ 2 ][ m ];
	for( auto i = 0L, a = 1L, b = 2L; i < m; i++, a = b + 1, b += i + 2 )
	{
		anss[ i ] = [ a, b ];
	}
	return anss.map!( ( a ) => a.to!( string[] ).join( " " ) ).join( "\n" );
}
