#include <stdio.h>
#include <cstdlib>
#include <iostream>
#include <ctime>
using namespace std;
int n, m, k;

int main()
{
    srand(time(0));
    int t;
    cin>>t;
    for(int i = 1 ; i <= t ; i++ )
    {
        cin>>n>>k;
        char f[100];
        sprintf(f, ".%d.in", i);
        freopen(f, "w", stdout);
        cout<<n<<" "<<k<<endl;
        for(int j = 0 ; j < k ; j++ )
        {
            int a = rand()%n+1, b = rand()%n+1;
            if( a > b ) swap(a,b);
            int c = rand()%n+1, d = rand()%n+1;
            if( c > d ) swap(c,d);
            cout<<a<<" "<<c<<" "<<b<<" "<<d<<" "<<(rand()%1000)*(rand()%2?-1:1)<<endl;
        }
    }

}
