#include <bits/stdc++.h>   using namespace std;   using ll = long long;   using llu = unsigned long long;   using ld = long double;   const double PI = acos(-1.0), g = 9.80665;   const int unseen = -1;   const ll inf = 1e18 + 505, ninf = -1e18 - 505;   const int MOD = 1000000007;   void solve(void) {     int n, p;     cin >> n >> p;     int vrtc = 0;     for (int i = 1; i <= n; i++) {       for (int j = i + 1; j <= n; j++) {         cout << i <<     << j <<   n ;         vrtc++;         if (vrtc == (2 * n + p)) return;       }     }   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(nullptr);     int testcase = 1;     cin >> testcase;     for (int tc = 1; tc <= testcase; tc++) {       solve();     }     return 0;   }   