#include <bits/stdc++.h>   #pragma GCC optimize( Ofast )   #pragma GCC target(         avx,avx2,fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native )   using namespace std;   long long MOD = 1e9 + 7;   int main() {     ios::sync_with_stdio(0), cin.tie(0), cout.tie(0),         cout << fixed << setprecision(20);     long long t;     cin >> t;     while (t--) {       long long n, p;       cin >> n >> p;       vector<pair<long long, long long> > ans;       for (int i = 0; i < 2 * n + p; i++) {         ans.push_back({i % n, (i + i / n + 1) % n});       }       for (auto i : ans) {         cout << i.first + 1 <<     << i.second + 1 <<   n ;       }     }   }   