#include <bits/stdc++.h>   using namespace std;   signed long long p[1000005] = {0};   void sieve() {     p[0] = 1;     p[1] = 1;     for (signed long long i = 2; i * i <= 1000000; i++) {       if (p[i] == 0) {         for (signed long long j = 2 * i; j <= 1000000; j = j + i) p[j] = 1;       }     }   }   int main() {     signed long long n, m, wt;     cin >> n >> m;     sieve();     for (signed long long i = n - 1; i <= 1000000; i++) {       if (p[i] == 0) {         wt = i;         break;       }     }     cout << wt <<     << wt << endl;     ;     for (signed long long i = 1; i < n - 1; i++)       cout << i <<     << i + 1 <<                <<  1  << endl;     cout << n - 1 <<     << n <<     << wt - (n - 2) << endl;     signed long long cnt = n - 1;     for (signed long long i = 1; i <= n; i++) {       for (signed long long j = i + 2; j <= n; j++) {         if (cnt == m) return 0;         cout << i <<     << j <<     << wt + 5 << endl;         cnt++;       }     }     return 0;   }   