#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);
if (n * (n - 1) / 2 < m)
return 0;
vector<int> v(n);
iota(v.begin(), v.end(), 1);
gen.shuffle(v);
cout << n << ' ' << m << '\n';
set<pair<int, int>> edges;
for (int i = 0; i < n - 1; i++)
{
edges.insert({v[i], v[i + 1]});
}
while (edges.size() < m)
{
int a = gen.randInt(1, n);
int b = gen.randInt(1, n);
if (a == b || edges.count({a, b}) || edges.count({b, a}))
continue;
edges.insert({a, b});
}
vector<int> c(m);
iota(c.begin(), c.end(), 1);
gen.shuffle(c);
vector<pair<int, int>> e(edges.begin(), edges.end());
gen.shuffle(e);
for (int i = 0; i < m; i++)
cout << e[i].first << ' ' << e[i].second << ' ' << c[i] << '\n';
cout << '\n';
return 0;
}