#include <bits/stdc++.h>   using namespace std;   int main() {     int t;     cin >> t;     while (t--) {       int n, p;       cin >> n >> p;       int cnt = 0;       for (int i = 1; i < n; ++i) {         for (int j = i + 1; j <= n; ++j) {           if (cnt == 2 * n + p) break;           cout << i <<     << j <<   n ;           cnt++;         }       }     }     return 0;   }   