#include "testlib.h"
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <vector>

using namespace std;

int main(int argc, char* argv[])
{
	registerGen(argc, argv, 1);
	
	int Nmin = atoi(argv[1]);
	int Nmax = atoi(argv[2]);
	
	int Mmin = atoi(argv[3]);
	int Mmax = atoi(argv[4]);
	
	int Kmin = atoi(argv[5]);
	int Kmax = atoi(argv[6]);
	
	
	int N = rnd.next(Nmin, Nmax);
	int M = rnd.next(Mmin, Mmax);
	cout << N << " " << M << endl;
	
	int center_v = rnd.next(2, N);
	
	for(int i = 0; i < M; ++i)
	{
	    vector<int> cur;
	    int K = rnd.next(Kmin, Kmax);
	    for(int j = 0; j < K; ++j) 
	    {
	        int tmp = rnd.next(1, N);
	        if (j == 0) tmp = 1;
	        else if (j % 2) tmp = center_v;
	        else
	        {
	            while(tmp == center_v) tmp = rnd.next(1, N);
	        }
	        cur.push_back(tmp);
	    }
	    cout << cur.size() << " ";
	    for(int j = 0; j < cur.size(); ++j) 
	    {
	        cout << cur[j];
	        if (j != cur.size() - 1) cout << " ";
	    }
	    cout << endl;
	}
	
	return 0;
}