uses
	math;

const
	maxn = 100000;

var
	n, m, s, i, l, r, w, sl, sr: longint;
	minc, maxc: longint;
	a: array [1..4 * maxn] of longint;

begin
	randseed := 228307447;

	n := 100000;
	m := 100000;
	minc := 1;
	maxc := maxlongint;

	s := 1;
	while (s < n) do
		s := s * 2;

	for i := 1 to n do begin
		a[i + s - 1] := minc + random(maxc - minc + 1);
	end;

	for i := s - 1 downto 1 do begin
		a[i] := min(a[2 * i], a[2 * i + 1]);
	end;

	writeln(n, ' ', m);
	for i := 1 to m do begin
		repeat
    		l := random(n) + 1;
    		r := random(n) + 1;
    	until (l <= r - n div 4) and (i < m div 2) or (l <= r) and (i >= m div 2) and (l >= r - 100);

    	sl := l;
    	sr := r;

    	l := l + s - 1;
    	r := r + s - 1;
		
		w := maxlongint;
		while (l <= r) do begin
			if (a[l] < w) then
				w := a[l];
			if (a[r] < w) then
				w := a[r];
			l := (l + 1) div 2;
			r := (r - 1) div 2;
		end;                

		writeln(sl, ' ', sr, ' ', w);
	end;
end.