#include <bits/stdc++.h>
#include "algotester_generator.h"
using namespace std;
int main(int argc, char* argv[])
{
auto gen = AlgotesterGenerator(argc, argv);
int n = gen.getArg<int>(2);
int m = gen.getArg<int>(3);
vector<int> c(n);
iota(c.begin(), c.end(), 1);
gen.shuffle(c);
int v = gen.randInt(n);
cout << n << ' ' << m << '\n';
for (int i = 0; i < n; i++)
{
if (i == v) continue;
int a = v;
int b = i;
if (gen.randInt(2) == 1)
swap(a, b);
cout << a + 1 << ' ' << b + 1 << ' ' << c[i] << '\n';
}
cout << '\n';
return 0;
}