#include <bits/stdc++.h>
using namespace std;
int main()
{
srand(clock()^time(0));
int n=rand()%5+5,m=rand()%5+5;
freopen("data.out","w",stdout);
cout<<n<<" "<<m<<"\n";
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
cout<<(int)(rand()%10*1e8)+rand()%10000*10000+rand()<<" ";
cout<<"\n";
}
for(int i=1;i<=n;i++)
{
int a[16]={0};
int k=rand()%n+1;
for(int j=1;j<=k;j++)
a[rand()%(n-1)+1]=1;
int cnt=0;
for(int j=1;j<=n;j++)
if(a[j]==1)
cnt++;
cout<<cnt<<" ";
for(int j=1;j<=n;j++)
if(a[j]==1)
cout<<j<<" ";
cout<<"\n";
}
return 0;
}