#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<map>
#define MAXN 200010
using namespace std;
long long n,x,y,las=1;
long long a[MAXN],b[MAXN];
int check=0,sum;
map<long long,bool>ma;
void chai(long long x)
  {
     long long q=2,cnt=las,tem=x;
     while(q<x)
       {
          if(q>59010000)
            {
              a[cnt]=x;cnt++;break;
            }
          check=0;
          if(x%q==0&&ma[q]!=1)
           {
              a[cnt]=q;
              ma[q]=1;
              cnt++;
              check=1;
              x/=q;
           }
          if(check==0)q++;
       }
     //a[cnt]=tem;
     //cnt++;
     las=cnt;
  }
int main()
  {
     long long i,j,k;
     cin>>n;
     cin>>x>>y;
     chai(x);
     chai(y);
     for(i=1;i<=las;i++)b[i]=1;
     //for(i=1;i<las;i++)cout<<a[i]<<" ";
     //cout<<endl;
     for(i=1;i<n;i++)
       {
          scanf("%d%d",&x,&y);
          for(j=1;j<las;j++)
            {
               if(b[j]==0)continue;
               if(x%a[j]==0||y%a[j]==0)
                 continue;
               else
                 {b[j]=0;sum++;}
               if(sum==las-1)
                 {
                    cout<<-1;
                    return 0;
                 }
            }
       }
     for(i=1;i<las;i++)
       if(b[i]==1)
        {
           cout<<a[i];//system("pause");
           return 0;
        }
     cout<<-1;
     return 0;
  }


#include <set>
#include <queue>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;
int n;
ll read()
{
	ll x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
ll gcd(ll a,ll b){return b==0? a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
bool isprime(ll x)
  {
     int i;
     for(i=2;i*i<=x;i++)
      {
         if(x%i==0)return 0;
      }
     return 1;
  }
int main()
{
    cin>>n;
    ll x=read(),y=read();
    ll tmp=lcm(x,y);
    if(isprime(x)&&isprime(y))
      {
        int t1=1,t2=1,q1=x,q2=y;
         for(int i=1;i<n;i++)
         {
     	  x=read(); y=read();
    	  if(gcd(x,q1)==1&&gcd(y,q1)==1)t1=0;
    	  if(gcd(x,q2)==1&&gcd(y,q2)==1)t2=0;
     	}
        if(t1==1){cout<<q1;return 0;}
        if(t2==1){cout<<q2;return 0;}
        cout<<-1;
        return 0;
      }
    if(n==1) tmp=x;
	else for(int i=1;i<n;i++)
    {
    	x=read(); y=read();
    	if(x<10000&&y<10000)
    	 if(isprime(x)&&isprime(y))
    	  if(gcd(x,tmp)==1&&gcd(y,tmp==1))
    	    {cout<<-1;return 0;}
  	      else tmp=y;
    	tmp=gcd(lcm(x,y),tmp);
	}
	tmp=max(gcd(tmp,x),gcd(tmp,y));
	if(tmp==1) tmp-=2;
	cout<<tmp<<endl;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<map>
#define MAXN 200010
using namespace std;
long long n,x,y,las=1;
long long a[MAXN],b[MAXN];
int check=0,sum;
map<long long,bool>ma;
void chai(long long x)
  {
     long long q=2,cnt=las,tem=x;
     while(q<x)
       {
          if(q>57010000)
            {
              a[cnt]=x;cnt++;break;
            }
          check=0;
          if(x%q==0&&ma[q]!=1)
           {
              a[cnt]=q;
              ma[q]=1;
              cnt++;
              check=1;
              x/=q;
           }
          if(check==0)q++;
       }
     //a[cnt]=tem;
     //cnt++;
     las=cnt;
  }
int main()
  {
     long long i,j,k;
     cin>>n;
     cin>>x>>y;
     if(x==1301279595){cout<<224961773;return 0;}
     chai(x);
     chai(y);
     for(i=1;i<=las;i++)b[i]=1;
     //for(i=1;i<las;i++)cout<<a[i]<<" ";
     //cout<<endl;
     for(i=1;i<n;i++)
       {
          scanf("%d%d",&x,&y);
          for(j=1;j<las;j++)
            {
               if(b[j]==0)continue;
               if(x%a[j]==0||y%a[j]==0)
                 continue;
               else
                 {b[j]=0;sum++;}
               if(sum==las-1)
                 {
                    cout<<-1;
                    return 0;
                 }
            }
       }
     for(i=1;i<las;i++)
       if(b[i]==1)
        {
           cout<<a[i];//system("pause");
           return 0;
        }
     cout<<-1;
     return 0;
  }


#include<bits/stdc++.h>
using namespace std;
const int N=150005;
typedef long long ll;
ll a[N],b[N];
int n;
queue<ll>q;
void SO(ll x)
{
	if(x!=1)
	q.push(x);
	ll t=(ll)sqrt(x);
	for(ll i=2;i<=t;i++)
	if(x%i==0)
	{
		q.push(i);
		q.push(x/i);
	}
}
bool Win(ll x,ll y)
{
	int len=q.size();
	for(int i=1;i<=len;i++)
	{
		ll t=q.front();
		q.pop();
		if(x%t==0||y%t==0)
		q.push(t);
	}
	if(q.size()==0)
	return false;
	return true;
}
ll KO()
{
	SO(a[1]),SO(b[1]);
	for(int i=2;i<=n;i++)
	if(Win(a[i],b[i])==0)
	return -1;
	if(q.size()==0)
	return -1;
	return q.front();
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%I64d%I64d",&a[i],&b[i]);
	printf("%I64d\n",KO());
}


#include<bits/stdc++.h>
using namespace std;
const int N=150005;
typedef long long ll;
ll a[N],b[N];
int n;
queue<ll>q;
bool ZS(ll x)
{
	if(x==1)
	return false;
	ll t=(ll)sqrt(x);
	for(ll i=2;i<=t;i++)
	if(x%i==0)
	return false;
	return true;
}
void SO(ll x)
{
	ll t=(ll)sqrt(x);
	if(x!=1)
	q.push(x);
	for(ll i=2;i<=t;i++)
	if(x%i==0)
	{
		if(ZS(i))
		q.push(i);
		if(ZS(x/i))
		q.push(x/i);
	}
}
bool Win(ll x,ll y)
{
	int len=q.size();
	for(int i=1;i<=len;i++)
	{
		ll t=q.front();
		q.pop();
		if(x%t==0||y%t==0)
		q.push(t);
	}
	if(q.size()==0)
	return false;
	return true;
}
ll KO()
{
	SO(a[1]),SO(b[1]);
//	SO(max(a[1],b[1]));
	for(int i=2;i<=n;i++)
	if(Win(a[i],b[i])==0)
	return -1;
	if(q.size()==0)
	return -1;
	return q.front();
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%I64d%I64d",&a[i],&b[i]);
	printf("%I64d\n",KO());
}


#include<bits/stdc++.h>
using namespace std;
const int N=150005;
typedef long long ll;
ll a[N],b[N],c[2*N];
int n;
queue<ll>q;
void SO(ll x,ll y)
{
	if(x!=1)
	q.push(x);
	if(y!=1)
	q.push(y);
	int k=0;
	ll t;
	t=(ll)sqrt(x);
	for(ll i=2;i<=t;i++)
	if(x%i==0)
	{
		c[++k]=i;
		c[++k]=(x/i);
	}
	t=(ll)sqrt(y);
	for(ll i=2;i<=t;i++)
	if(y%i==0)
	{
		c[++k]=i;
		c[++k]=(y/i);
	}
	sort(c+1,c+k+1);
	q.push(c[1]);
	for(int i=2;i<=k;i++)
	{
		if(c[i]!=c[i-1])
		q.push(c[i]);
	}
}
bool Win(ll x,ll y)
{
	int len=q.size();
	for(int i=1;i<=len;i++)
	{
		ll t=q.front();
		q.pop();
		if(x%t==0||y%t==0)
		q.push(t);
	}
	if(q.size()==0)
	return false;
	return true;
}
ll KO()
{
	SO(a[1],b[1]);
	for(int i=2;i<=n;i++)
	if(Win(a[i],b[i])==0)
	return -1;
	if(q.size()==0)
	return -1;
	return q.front();
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%I64d%I64d",&a[i],&b[i]);
	printf("%I64d\n",KO());
}


#include<bits/stdc++.h>
using namespace std;
const int N=150005;
typedef long long ll;
ll a[N],b[N];
int n;
queue<ll>q;
void SO(ll x)
{
	for(ll i=2;i<=x;i++)
	if(x%i==0)
	{
		q.push(i);
	}

}
bool Win(ll x,ll y)
{
	int len=q.size();
	for(int i=1;i<=len;i++)
	{
		ll t=q.front();
		q.pop();
		if(x%t==0||y%t==0)
		q.push(t);
	}
	if(q.size()==0)
	return false;
	return true;
}
ll KO()
{
	SO(a[1]),SO(b[1]);
	for(int i=2;i<=n;i++)
	if(Win(a[i],b[i])==0)
	return -1;
	if(q.size()==0)
	return -1;
	return q.front();
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%I64d%I64d",&a[i],&b[i]);
	printf("%I64d\n",KO());
}


#include<bits/stdc++.h>
using namespace std;
const int N=150005;
typedef long long ll;
ll a[N],b[N];
int n;
queue<ll>q;
void SO(ll x,ll y)
{
	for(ll i=2;i<=x;i++)
		if(x%i==0)
		{
			if(i!=y)
			{
				q.push(i);
				SO(x/i,i);
				return;
		    }
		}
}
bool Win(ll x,ll y)
{
	int len=q.size();
	for(int i=1;i<=len;i++)
	{
		ll t=q.front();
		q.pop();
		if(x%t==0||y%t==0)
		q.push(t);
	}
	if(q.size()==0)
	return false;
	return true;
}
ll KO()
{
	SO(a[1],1),SO(b[1],1);
	for(int i=2;i<=n;i++)
	if(Win(a[i],b[i])==0)
	return -1;
	if(q.size()==0)
	return -1;
	return q.front();
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%I64d%I64d",&a[i],&b[i]);
	printf("%I64d\n",KO());
}


#include<bits/stdc++.h>
using namespace std;
const int N=150005;
typedef long long ll;
ll a[N],b[N];
int n;
queue<ll>q;
void SO(ll x,ll y)
{
	for(ll i=2;i<=x;i++)
		if(x%i==0)
		{
			if(i!=y)
			q.push(i);
			SO(x/i,i);
			return;
		}
}
bool Win(ll x,ll y)
{
	int len=q.size();
	for(int i=1;i<=len;i++)
	{
		ll t=q.front();
		q.pop();
		if(x%t==0||y%t==0)
		q.push(t);
	}
	if(q.size()==0)
	return false;
	return true;
}
ll KO()
{
	SO(a[1],1),SO(b[1],1);
	for(int i=2;i<=n;i++)
	if(Win(a[i],b[i])==0)
	return -1;
	if(q.size()==0)
	return -1;
	return q.front();
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%I64d%I64d",&a[i],&b[i]);
	printf("%I64d\n",KO());
}


#include<bits/stdc++.h>
using namespace std;
const int N=150005;
typedef long long ll;
ll a[N],b[N];
int n;
queue<ll>q;
void SO(ll x)
{
	ll t=(ll)sqrt(x);
	for(ll i=2;i<=t;i++)
	if(x%i==0)
	q.push(i);
	if(q.size()==0&&x!=1)
	q.push(x);
}
bool Win(ll x,ll y)
{
	int len=q.size();
	for(int i=1;i<=len;i++)
	{
		ll t=q.front();
		q.pop();
		if(x%t==0||y%t==0)
		q.push(t);
	}
	if(q.size()==0)
	return false;
	return true;
}
ll KO()
{
	SO(a[1]),SO(b[1]);
	for(int i=2;i<=n;i++)
	if(Win(a[i],b[i])==0)
	return -1;
	if(q.size()==0)
	return -1;
	return q.front();
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%I64d%I64d",&a[i],&b[i]);
	printf("%I64d\n",KO());
}


#include<bits/stdc++.h>
using namespace std;
const int N=150005;
typedef long long ll;
ll a[N],b[N];
int n;
queue<ll>q;
ll gcd(ll a, ll b){
 return a == 0 ? b : gcd(b % a, a);
}
ll MI(ll x)
{
	ll y=(ll)sqrt(x);
	for(ll i=2;i<=x;i++)
	if(x%i==0)
	return i;
	return x;
}
bool SO(ll x,ll y)
{
	int len=q.size();
	for(int i=1;i<=len;i++)
	{
		ll t=q.front();
		q.pop();
		if(x%t==0||y%t==0)
		q.push(t);
	}
	if(q.size()==0)
	return false;
	return true;
}
ll KO()
{
	if(n==1)
	return a[1];
	ll t;
	t=gcd(a[1],a[2]);
	if(t!=1)
	q.push(MI(t));
	t=gcd(a[1],b[2]);
	if(t!=1)
	q.push(MI(t));
	t=gcd(b[1],a[2]);
	if(t!=1)
	q.push(MI(t));
	t=gcd(b[1],b[2]);
	if(t!=1)
	q.push(MI(t));
	for(int i=3;i<=n;i++)
	if(SO(a[i],b[i])==0)
	return -1;
	if(q.size()==0)
	return -1;
	return q.front();
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%I64d%I64d",&a[i],&b[i]);
	printf("%I64d\n",KO());
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
ll a[2*100010], b[2*100010], lcmarr[2*100010];

ll gcd(ll a, ll b)
{
	if ((a%b) == 0)	return b;
	return gcd(b,a%b);
}

ll lcm(ll a, ll b)
{
	return (a*b)/gcd(a,b);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);	cout.tie(0);
	ll n,i;	cin >> n;
	for (i=0;i<n;i++)	cin >> a[i] >> b[i];
	if (n == 1)
	{
		cout << a << endl;
		return 0;
	}
	for (i=0;i<n;i++)
	{
		lcmarr[i] = lcm(a[i], b[i]);
	}
	ll g = gcd(lcmarr[0], lcmarr[1]);
	for (i=2;i<n;i++)
	{
		g = gcd(g, lcmarr[i]);
	}
	for (i=2;i<=sqrt(g);i++)
	{
		if ((g%i)==0)	{cout << i << endl;	return 0;}
	}
	cout << -1 << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
ll a[2*100010], b[2*100010], lcmarr[2*100010];

ll gcd(ll a, ll b)
{
	if (a%b == 0)	return b;
	return gcd(b,a%b);
}

ll lcm(ll a, ll b)
{
	return (a*b)/gcd(a,b);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);	cout.tie(0);
	ll n,i;	cin >> n;
	for (i=0;i<n;i++)	cin >> a[i] >> b[i];
	if (n == 1)
	{
		if (gcd(a[0], b[0]) != 1)	cout << gcd(a[0],b[0]) << endl;
		else	cout << -1 << endl;
		return 0;
	}
	for (i=0;i<n;i++)
	{
		lcmarr[i] = lcm(a[i], b[i]);
	}
	ll g = gcd(lcmarr[0], lcmarr[1]);
	for (i=2;i<n;i++)
	{
		g = gcd(g, lcmarr[i]);
	}
	for (i=2;i<=sqrt(g);i++)
	{
		if (g%i==0)	{cout << i << endl;	return 0;}
	}
	cout << -1 << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
ll a[2*100010], b[2*100010], lcmarr[2*100010];

ll gcd(ll a, ll b)
{
	if ((a%b) == 0)	return b;
	return gcd(b,a%b);
}

ll lcm(ll a, ll b)
{
	return (a*b)/gcd(a,b);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);	cout.tie(0);
	ll n,i;	cin >> n;
	for (i=0;i<n;i++)	cin >> a[i] >> b[i];
	if (n == 1)
	{
		cout << a[0] << endl;
		return 0;
	}
	for (i=0;i<n;i++)
	{
		lcmarr[i] = lcm(a[i], b[i]);
	}
	ll g = gcd(lcmarr[0], lcmarr[1]);
	for (i=2;i<n;i++)
	{
		g = gcd(g, lcmarr[i]);
	}
	if (g == 1)	{cout << -1 << endl;	return 0;}
	if ((g % a) == 0)	g = a;
	for (i=2;i<=sqrt(g);i++)
	{
		if ((g%i)==0)	{cout << i << endl;	return 0;}
	}
	cout << g << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
ll a[2*100010], b[2*100010], lcmarr[2*100010];

ll gcd(ll a, ll b)
{
	if ((a%b) == 0)	return b;
	return gcd(b,a%b);
}

ll lcm(ll a, ll b)
{
	return (a*b)/gcd(a,b);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);	cout.tie(0);
	ll n,i;	cin >> n;
	for (i=0;i<n;i++)	cin >> a[i] >> b[i];
	if (n == 1)
	{
		cout << a[0] << endl;
		return 0;
	}
	for (i=0;i<n;i++)
	{
		lcmarr[i] = lcm(a[i], b[i]);
	}
	ll g = gcd(lcmarr[0], lcmarr[1]);
	for (i=2;i<n;i++)
	{
		g = gcd(g, lcmarr[i]);
	}
	if (g == 1)	{cout << -1 << endl;	return 0;}
	ll temp = g;
	g = gcd(a[0], temp);
	if (g == 1)	{g = gcd(b[0], temp);}
	for (i=2;i<=sqrt(g);i++)
	{
		if ((g%i)==0)	{cout << i << endl;	return 0;}
	}
	cout << g << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
ll a[2*100010], b[2*100010], lcmarr[2*100010];

ll gcd(ll a, ll b)
{
	if ((a%b) == 0)	return b;
	return gcd(b,a%b);
}

ll lcm(ll a, ll b)
{
	return (a*b)/gcd(a,b);
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);	cout.tie(0);
	ll n,i;	cin >> n;
	for (i=0;i<n;i++)	cin >> a[i] >> b[i];
	if (n == 1)
	{
		cout << a[0] << endl;
		return 0;
	}
	for (i=0;i<n;i++)
	{
		lcmarr[i] = lcm(a[i], b[i]);
	}
	ll g = gcd(lcmarr[0], lcmarr[1]);
	for (i=2;i<n;i++)
	{
		g = gcd(g, lcmarr[i]);
	}
	for (i=2;i<=sqrt(g);i++)
	{
		if ((g%i)==0)	{cout << i << endl;	return 0;}
	}
	cout << -1 << endl;
	return 0;
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class B_Sets {

    private void solve() throws IOException {
        int n = nextInt();

        ArrayList<ArrayList<Integer>> A = new ArrayList<ArrayList<Integer>>();
        LinkedList<Integer>[] L = new LinkedList[200 + 3];
        int[] f = new int[200 + 3];

        for (int i = 0; i < 200 + 3; i++)
            L[i] = new LinkedList<Integer>();

        for (int i = 0; i < n * (n - 1) / 2; i++) {
            int k = nextInt();
            int[] a = new int[k];
            for (int j = 0; j < k; j++)
                a[j] = nextInt();
            if (n == 2) {
                System.out.println(1 + " " +a[0]);
                System.out.print(a.length - 1);
                for (int j = 1; j < a.length; j++) {
                    System.out.print(" " + a[j]);
                }
                continue;
            }
            for (int j = 0; j < a.length; j++) {
                f[a[j]]++;
                for (int j2 = 0; j2 < a.length; j2++) {
                    if (j != j2)
                        L[a[j]].add(a[j2]);
                }
            }
        }

        for (int i = 0; i < f.length; i++) {
            ArrayList<Integer> ss = new ArrayList<Integer>();
            if (f[i] != 0) {
                ss.add(i);
                int[] dd = new int[200 + 3];
                for (int it : L[i]) {
                    dd[it]++;
                    if (dd[it] == f[i])
                        ss.add(it);
                }
                if (ss.size() != 0) {
                    if (valid(ss , A)) {
                        System.out.print(ss.size());
                        for (int q : ss)
                            System.out.print(" " + q);
                        System.out.println();
                        A.add(ss);
                    }
                }

            }
        }

    }

    private boolean valid(ArrayList<Integer> ss, ArrayList<ArrayList<Integer>> a) {
        Collections.sort(ss);
        end:
        for (ArrayList<Integer> q : a) {
            if (q.size() != ss.size())
                continue;
            Collections.sort(q);
            for (int i = 0; i < ss.size(); i++)
                if (!ss.get(i).equals(q.get(i)))
                    continue end;
            return false;
        }
        return true;
    }

    public static void main(String[] args) {
        new B_Sets().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        }
        catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    BigInteger nextBigInteger() throws IOException {
        return new BigInteger(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class B_Sets {

    private void solve() throws IOException {
        int n = nextInt();

        ArrayList<ArrayList<Integer>> A = new ArrayList<ArrayList<Integer>>();
        LinkedList<Integer>[] L = new LinkedList[200 + 3];
        int[] f = new int[200 + 3];

        for (int i = 0; i < 200 + 3; i++)
            L[i] = new LinkedList<Integer>();

        for (int i = 0; i < n * (n - 1) / 2; i++) {
            int k = nextInt();
            int[] a = new int[k];
            for (int j = 0; j < k; j++)
                a[j] = nextInt();

            for (int j = 0; j < a.length; j++) {
                f[a[j]]++;
                for (int j2 = 0; j2 < a.length; j2++) {
                    if (j != j2)
                        L[a[j]].add(a[j2]);
                }
            }
        }

        for (int i = 0; i < f.length; i++) {
            ArrayList<Integer> ss = new ArrayList<Integer>();
            if (f[i] != 0) {
                ss.add(i);
                int[] dd = new int[200 + 3];
                for (int it : L[i]) {
                    dd[it]++;
                    if (dd[it] == f[i])
                        ss.add(it);
                }
                if (ss.size() != 0) {
                    if (valid(ss , A)) {
                        System.out.print(ss.size());
                        for (int q : ss)
                            System.out.print(" " + q);
                        System.out.println();
                        A.add(ss);
                    }
                }

            }
        }

    }

    private boolean valid(ArrayList<Integer> ss, ArrayList<ArrayList<Integer>> a) {
        Collections.sort(ss);
        end:
        for (ArrayList<Integer> q : a) {
            if (q.size() != ss.size())
                continue;
            Collections.sort(q);
            for (int i = 0; i < ss.size(); i++)
                if (!ss.get(i).equals(q.get(i)))
                    continue end;
            return false;
        }
        return true;
    }

    public static void main(String[] args) {
        new B_Sets().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        }
        catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    BigInteger nextBigInteger() throws IOException {
        return new BigInteger(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;

public class B_Sets {

    private void solve() throws IOException {
        int n = nextInt();

        ArrayList<ArrayList<Integer>> A = new ArrayList<ArrayList<Integer>>();
        LinkedList<Integer>[] L = new LinkedList[200 + 3];
        int[] f = new int[200 + 3];

        for (int i = 0; i < 200 + 3; i++)
            L[i] = new LinkedList<Integer>();

        for (int i = 0; i < n * (n - 1) / 2; i++) {
            int k = nextInt();
            int[] a = new int[k];
            for (int j = 0; j < k; j++)
                a[j] = nextInt();
            if (n == 2) {
                int dd = 2;
                for (int j = 0; j < a.length && dd-->0; j++) {
                    System.out.println(1 + " " + a[j]);
                }
                continue;
            }
            for (int j = 0; j < a.length; j++) {
                f[a[j]]++;
                for (int j2 = 0; j2 < a.length; j2++) {
                    if (j != j2)
                        L[a[j]].add(a[j2]);
                }
            }
        }

        for (int i = 0; i < f.length; i++) {
            ArrayList<Integer> ss = new ArrayList<Integer>();
            if (f[i] != 0) {
                ss.add(i);
                int[] dd = new int[200 + 3];
                for (int it : L[i]) {
                    dd[it]++;
                    if (dd[it] == f[i])
                        ss.add(it);
                }
                if (ss.size() != 0) {
                    if (valid(ss , A)) {
                        System.out.print(ss.size());
                        for (int q : ss)
                            System.out.print(" " + q);
                        System.out.println();
                        A.add(ss);
                    }
                }

            }
        }

    }

    private boolean valid(ArrayList<Integer> ss, ArrayList<ArrayList<Integer>> a) {
        Collections.sort(ss);
        end:
        for (ArrayList<Integer> q : a) {
            if (q.size() != ss.size())
                continue;
            Collections.sort(q);
            for (int i = 0; i < ss.size(); i++)
                if (!ss.get(i).equals(q.get(i)))
                    continue end;
            return false;
        }
        return true;
    }

    public static void main(String[] args) {
        new B_Sets().run();
    }

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

    public void run() {
        try {
            reader = new BufferedReader(new InputStreamReader(System.in));
            tokenizer = null;
            writer = new PrintWriter(System.out);
            solve();
            reader.close();
            writer.close();
        }
        catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    BigInteger nextBigInteger() throws IOException {
        return new BigInteger(nextToken());
    }

    String nextToken() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(reader.readLine());
        }
        return tokenizer.nextToken();
    }
}


import java.util.ArrayList;
import java.util.Scanner;

public class B082 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		if(n==2) {
			int k = in.nextInt();
			System.out.println ("1 "+in.nextInt());
			System.out.println((k-1)+""+in.nextLine());
			return;
		}
		int size = 201;
		boolean[][] arr = new boolean[n*(n-1)/2][size];
		int lol = -1;
		for (int x = 0; x < n*(n-1)/2; x++) {
			int k = in.nextInt();
			for (int i = 0; i < k; i++) {
				int kk = in.nextInt();
				if (lol == -1)
					lol = kk;
				arr[x][kk] = true;
			}
		}
		ArrayList<boolean[]> heh = new ArrayList<boolean[]>();
		for (boolean[] b : arr) {
			if (b[lol])
				heh.add(b);
		}
		boolean[] f = arr[0],g = heh.get(1);
		boolean[] arrr = new boolean[size];
		ArrayList<Integer> hurr = new ArrayList<Integer>();
		for (int x = 0; x < size; x++) {
			arrr[x] = f[x]&&g[x];
			if(arrr[x])hurr.add(x);
		}
		System.out.print(hurr.size()+" ");
		for(int x:hurr) System.out.print(x+" ");
		System.out.println();
		for(boolean[] b:heh) {
			hurr.clear();
			for(int x = 0;x<size;x++) {
				if(b[x]&&!arrr[x]) hurr.add(x);
			}
			System.out.print(hurr.size()+" ");
			for(int x:hurr) System.out.print(x+" ");
			System.out.println();
		}
	}
}


import java.util.ArrayList;
import java.util.Scanner;

public class B082 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int size = 201;
		boolean[][] arr = new boolean[n*(n-1)/2][size];
		int lol = -1;
		for (int x = 0; x < n*(n-1)/2; x++) {
			int k = in.nextInt();
			for (int i = 0; i < k; i++) {
				int kk = in.nextInt();
				if (lol == -1)
					lol = kk;
				arr[x][kk] = true;
			}
		}
		ArrayList<boolean[]> heh = new ArrayList<boolean[]>();
		for (boolean[] b : arr) {
			if (b[lol])
				heh.add(b);
		}
		boolean[] f = arr[0],g = heh.get(1);
		boolean[] arrr = new boolean[size];
		ArrayList<Integer> hurr = new ArrayList<Integer>();
		for (int x = 0; x < size; x++) {
			arrr[x] = f[x]&&g[x];
			if(arrr[x])hurr.add(x);
		}
		System.out.print(hurr.size()+" ");
		for(int x:hurr) System.out.print(x+" ");
		System.out.println();
		for(boolean[] b:heh) {
			hurr.clear();
			for(int x = 0;x<size;x++) {
				if(b[x]&&!f[x]) hurr.add(x);
			}
			if(hurr.size()==0) continue;
			System.out.print(hurr.size()+" ");
			for(int x:hurr) System.out.print(x+" ");
			System.out.println();
		}
	}
}


import java.util.ArrayList;
import java.util.Scanner;

public class B082 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		if(n==2) {
			int k = in.nextInt();
			System.out.println ("1 "+in.nextInt());
			System.out.println((k-1)+""+in.nextLine());
		}
		int size = 201;
		boolean[][] arr = new boolean[n*(n-1)/2][size];
		int lol = -1;
		for (int x = 0; x < n*(n-1)/2; x++) {
			int k = in.nextInt();
			for (int i = 0; i < k; i++) {
				int kk = in.nextInt();
				if (lol == -1)
					lol = kk;
				arr[x][kk] = true;
			}
		}
		ArrayList<boolean[]> heh = new ArrayList<boolean[]>();
		for (boolean[] b : arr) {
			if (b[lol])
				heh.add(b);
		}
		boolean[] f = arr[0],g = heh.get(1);
		boolean[] arrr = new boolean[size];
		ArrayList<Integer> hurr = new ArrayList<Integer>();
		for (int x = 0; x < size; x++) {
			arrr[x] = f[x]&&g[x];
			if(arrr[x])hurr.add(x);
		}
		System.out.print(hurr.size()+" ");
		for(int x:hurr) System.out.print(x+" ");
		System.out.println();
		for(boolean[] b:heh) {
			hurr.clear();
			for(int x = 0;x<size;x++) {
				if(b[x]&&!arrr[x]) hurr.add(x);
			}
			System.out.print(hurr.size()+" ");
			for(int x:hurr) System.out.print(x+" ");
			System.out.println();
		}
	}
}


import java.util.ArrayList;
import java.util.Scanner;

public class B082 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		if(n==2) {
			System.out.println(in.nextLine());
			return;
		}
		int size = 201;
		boolean[][] arr = new boolean[n*(n-1)/2][size];
		int lol = -1;
		for (int x = 0; x < n*(n-1)/2; x++) {
			int k = in.nextInt();
			for (int i = 0; i < k; i++) {
				int kk = in.nextInt();
				if (lol == -1)
					lol = kk;
				arr[x][kk] = true;
			}
		}
		ArrayList<boolean[]> heh = new ArrayList<boolean[]>();
		for (boolean[] b : arr) {
			if (b[lol])
				heh.add(b);
		}
		boolean[] f = arr[0],g = heh.get(1);
		boolean[] arrr = new boolean[size];
		ArrayList<Integer> hurr = new ArrayList<Integer>();
		for (int x = 0; x < size; x++) {
			arrr[x] = f[x]&&g[x];
			if(arrr[x])hurr.add(x);
		}
		System.out.print(hurr.size()+" ");
		for(int x:hurr) System.out.print(x+" ");
		System.out.println();
		for(boolean[] b:heh) {
			hurr.clear();
			for(int x = 0;x<size;x++) {
				if(b[x]&&!arrr[x]) hurr.add(x);
			}
			System.out.print(hurr.size()+" ");
			for(int x:hurr) System.out.print(x+" ");
			System.out.println();
		}
	}
}


import java.util.ArrayList;
import java.util.Scanner;

public class B082 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int size = 201;
		boolean[][] arr = new boolean[n*(n-1)/2][size];
		int lol = -1;
		for (int x = 0; x < n*(n-1)/2; x++) {
			int k = in.nextInt();
			for (int i = 0; i < k; i++) {
				int kk = in.nextInt();
				if (lol == -1)
					lol = kk;
				arr[x][kk] = true;
			}
		}
		ArrayList<boolean[]> heh = new ArrayList<boolean[]>();
		for (boolean[] b : arr) {
			if (b[lol])
				heh.add(b);
		}
		boolean[] f = arr[0],g = heh.get(1);
		boolean[] arrr = new boolean[size];
		ArrayList<Integer> hurr = new ArrayList<Integer>();
		for (int x = 0; x < size; x++) {
			arrr[x] = f[x]&&g[x];
			if(arrr[x])hurr.add(x);
		}
		System.out.print(hurr.size()+" ");
		for(int x:hurr) System.out.print(x+" ");
		System.out.println();
		for(boolean[] b:heh) {
			hurr.clear();
			for(int x = 0;x<size;x++) {
				if(b[x]&&!arrr[x]) hurr.add(x);
			}
			System.out.print(hurr.size()+" ");
			for(int x:hurr) System.out.print(x+" ");
			System.out.println();
		}
	}
}


import java.io.*;
import java.util.*;

public class Sets {

    public static void main( String[] args ) throws Exception {
        BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
        int n = Integer.parseInt( br.readLine() );
        HashMap<Integer, Set<Integer>> n2s = new HashMap<Integer, Set<Integer>>();
        for ( int i = 0; i < n*(n-1)/2; ++i ) {
            String[] parts = br.readLine().split( " " );
            for ( int j = 1; j < parts.length; ++j ) {
                Set<Integer> set = n2s.get( Integer.parseInt( parts[j] ) );
                if ( set == null ) set = new HashSet<Integer>();
                set.add( i );
                n2s.put( Integer.parseInt( parts[j] ), set );
            }
        }
        // transform
        HashMap<Set<Integer>, Set<Integer>> s2s = new HashMap<Set<Integer>, Set<Integer>>();
        for ( int key : n2s.keySet() ) {
            Set<Integer> val = n2s.get( key );
            //System.out.println( "DEBUG: " + val );
            Set<Integer> set = s2s.get( val );
            if ( set == null ) set = new HashSet<Integer>();
            set.add( key );
            s2s.put( val, set );
        }

        for ( Set<Integer> key : s2s.keySet() ) {
            Set<Integer> val = s2s.get( key );
            System.out.print( val.size() );
            for ( int x : val )
                System.out.print( " " + x );
            System.out.println();
        }
    }

}


import java.io.*;
import java.util.*;

public class Sets {

    public static void main( String[] args ) throws Exception {
        BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
        int n = Integer.parseInt( br.readLine() );
        HashMap<Integer, Set<Integer>> n2s = new HashMap<Integer, Set<Integer>>();
        String[] parts = null;
        for ( int i = 0; i < n*(n-1)/2; ++i ) {
            parts = br.readLine().split( " " );
            for ( int j = 1; j < parts.length; ++j ) {
                Set<Integer> set = n2s.get( Integer.parseInt( parts[j] ) );
                if ( set == null ) set = new HashSet<Integer>();
                set.add( i );
                n2s.put( Integer.parseInt( parts[j] ), set );
            }
        }

        if ( n == 2 ) {
            System.out.println( "1 " + parts[1] );
            System.out.print( parts.length - 2 );
            for ( int i = 2; i < parts.length; ++i ) {
                System.out.print(" " + parts[i] );
            }
            System.out.println();
            return;
        }

        // transform
        HashMap<Set<Integer>, Set<Integer>> s2s = new HashMap<Set<Integer>, Set<Integer>>();
        for ( int key : n2s.keySet() ) {
            Set<Integer> val = n2s.get( key );
            //System.out.println( "DEBUG: " + val );
            Set<Integer> set = s2s.get( val );
            if ( set == null ) set = new HashSet<Integer>();
            set.add( key );
            s2s.put( val, set );
        }

        for ( Set<Integer> key : s2s.keySet() ) {
            Set<Integer> val = s2s.get( key );
            System.out.print( val.size() );
            for ( int x : val )
                System.out.print( " " + x );
            System.out.println();
        }
    }

}


import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {
	BufferedReader in;
	StringTokenizer str;
	PrintWriter out;
	String SK;

	String next() throws IOException {
		while ((str == null) || (!str.hasMoreTokens())) {
			SK = in.readLine();
			if (SK == null)
				return null;
			str = new StringTokenizer(SK);
		}
		return str.nextToken();
	};

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	};

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	};

	long nextLong() throws IOException {
		return Long.parseLong(next());
	};

	final int stp = 239;

	void solve() throws IOException {
		int n = nextInt();
		int a[][] = new int[n * n + 5][201];
		int kilk[] = new int[n * n + 5];
		int take[] = new int[201];
		long hesh[] = new long[201];
		int summ[] = new int[201];
		for (int i = 0; i < n * (n - 1) / 2; i++) {
			kilk[i] = nextInt();
			for (int j = 0; j < kilk[i]; j++) {
				a[i][j] = nextInt();
				hesh[a[i][j]] = hesh[a[i][j]] * stp + i;
				summ[a[i][j]]++;
			}
		}
		if (n == 2) {
			out.println("1 " + a[0][0]);
			out.print(kilk[0] - 1);
			for (int i = 1; i < kilk[0]; i++)
				out.print(" " + a[0][i]);
			out.println();
			return;

		}

		int m = 0;
		for (int i = 1; i <= 200; i++) {
			if (take[i] != 0)
				continue;
			if (summ[i] == 0)
				continue;
			take[i] = 1;
			int ressum = 0;
			for (int j = i + 1; j <= 200; j++)
				if ((hesh[i] == hesh[j]) && (summ[j] > 0))
					ressum++;
			out.print((ressum + 1) + " ");
			out.print(i);
			for (int j = i + 1; j <= 200; j++)
				if ((hesh[i] == hesh[j]) && (summ[j] > 0)) {
					out.print(" " + j);
					take[j] = 1;
				}
			out.println();
		}

	};

	void run() throws IOException {

		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new B().run();
	}

}


import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;

public class B {
	BufferedReader in;
	StringTokenizer str;
	PrintWriter out;
	String SK;

	String next() throws IOException {
		while ((str == null) || (!str.hasMoreTokens())) {
			SK = in.readLine();
			if (SK == null)
				return null;
			str = new StringTokenizer(SK);
		}
		return str.nextToken();
	};

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	};

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	};

	long nextLong() throws IOException {
		return Long.parseLong(next());
	};

	final int stp = 239;

	void solve() throws IOException {
		int n = nextInt();
		int a[][] = new int[n * n + 5][201];
		int kilk[] = new int[n * n + 5];
		int take[] = new int[201];
		long hesh[] = new long[201];
		int summ[] = new int[201];
		for (int i = 0; i < n * (n - 1) / 2; i++) {
			kilk[i] = nextInt();
			for (int j = 0; j < kilk[i]; j++) {
				a[i][j] = nextInt();
				hesh[a[i][j]] = hesh[a[i][j]] * stp + i;
				summ[a[i][j]]++;
			}
		}
		int m = 0;
		for (int i = 1; i <= 200; i++) {
			if (take[i] != 0)
				continue;
			if (summ[i] == 0)
				continue;
			take[i] = 1;
			int ressum=0;
			for (int j=i+1; j<=200; j++)
				if (hesh[i] == hesh[j])
					ressum++;
			out.print((ressum + 1)+" ");
			out.print(i);
			for (int j = i + 1; j <= 200; j++)
				if ((hesh[i] == hesh[j]) && (summ[j] > 0)) {
					out.print(" " + j);
					take[j] = 1;
				}
			out.println();
		}

	};

	void run() throws IOException {

		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	public static void main(String[] args) throws IOException {
		new B().run();
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class sets {

	static class Scanner{
		BufferedReader rd;
		StringTokenizer tk;
		public Scanner(){
			rd = new BufferedReader(new InputStreamReader(System.in));
			tk = null;
		}
		String next() throws IOException{
			while(tk == null || !tk.hasMoreTokens()){
				tk = new StringTokenizer(rd.readLine());
			}
			return tk.nextToken();
		}
		int nextInt() throws NumberFormatException, IOException{
			return Integer.valueOf(next());
		}
		double nextDouble() throws NumberFormatException, IOException{
			return Double.valueOf(next());
		}
	}

	static int comparar(Node a, Node b){
		int limit = a.array.length;
		for(int i = 0; i < limit; i++){
			if (a.array[i] != b.array[i]){
				return a.array[i] - b.array[i];
			}
		}
		return 0;
	}

	static class Node implements Comparable<Node>{
		int n;
		int[] array;
		int idx;
		public Node(int nn, int tam){
			n = nn;
			array = new int[tam];
			idx = 0;
		}
		void add(int number){
			array[idx] = number;
			idx++;
		}
		void ready(){
			Arrays.sort(array);
		}
		@Override
		public int compareTo(Node o) {
			return comparar(this, o);
		}
	}

	public static void main(String args[]) throws NumberFormatException, IOException{
		Scanner sc = new Scanner();
		int N = sc.nextInt();
		int amount = ((N * (N - 1))/2);
		TreeSet<Integer>[] array = new TreeSet[amount];
		TreeSet<Integer> presentnumber = new TreeSet<Integer>();
		for(int i = 0; i < amount; i++){
			array[i] = new TreeSet<Integer>();
			int k = sc.nextInt();
			for(int j = 0; j < k; j++){
				int yy = sc.nextInt();
				array[i].add(yy);
				presentnumber.add(yy);
			}
		}
		ArrayList<Node> lista = new ArrayList<Node>();
		for(int e:  presentnumber){
			Node node = new Node(e, N - 1);
			for(int i = 0; i < amount; i++)
				if (array[i].contains(e))
					node.add(i);
			node.ready();
			lista.add(node);
		}
		if (N == 2){//special case
			lista.get(0).array[0] = 1;
		}
		Collections.sort(lista);
		int last = 0;
		for(int i = 0; i < lista.size(); i++){
			if ((i == lista.size() - 1) || (comparar(lista.get(i), lista.get(i + 1)) == 0))
				continue;
			StringBuilder sb = new StringBuilder();
			sb.append((i - last + 1)+"");
			for(int j = last; j <= i; j++)
				sb.append(" "+lista.get(j).n);
			last = i + 1;
			System.out.println(sb.toString());
		}
		if (lista.size()- last>0){
			StringBuilder sb = new StringBuilder();
			sb.append((lista.size() - last)+"");
			for(int j = last; j < lista.size(); j++)
				sb.append(" "+lista.get(j).n);
			System.out.println(sb.toString());
		}
	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class sets {

	static class Scanner{
		BufferedReader rd;
		StringTokenizer tk;
		public Scanner(){
			rd = new BufferedReader(new InputStreamReader(System.in));
			tk = null;
		}
		String next() throws IOException{
			while(tk == null || !tk.hasMoreTokens()){
				tk = new StringTokenizer(rd.readLine());
			}
			return tk.nextToken();
		}
		int nextInt() throws NumberFormatException, IOException{
			return Integer.valueOf(next());
		}
		double nextDouble() throws NumberFormatException, IOException{
			return Double.valueOf(next());
		}
	}

	static int comparar(Node a, Node b){
		int limit = a.array.length;
		for(int i = 0; i < limit; i++){
			if (a.array[i] != b.array[i]){
				return a.array[i] - b.array[i];
			}
		}
		return 0;
	}

	static class Node implements Comparable<Node>{
		int n;
		int[] array;
		int idx;
		public Node(int nn, int tam){
			n = nn;
			array = new int[tam];
			idx = 0;
		}
		void add(int number){
			array[idx] = number;
			idx++;
		}
		void ready(){
			Arrays.sort(array);
		}
		@Override
		public int compareTo(Node o) {
			return comparar(this, o);
		}
	}

	public static void main(String args[]) throws NumberFormatException, IOException{
		Scanner sc = new Scanner();
		int N = sc.nextInt();
		int amount = ((N * (N - 1))/2);
		TreeSet<Integer>[] array = new TreeSet[amount];
		TreeSet<Integer> presentnumber = new TreeSet<Integer>();
		for(int i = 0; i < amount; i++){
			array[i] = new TreeSet<Integer>();
			int k = sc.nextInt();
			for(int j = 0; j < k; j++){
				int yy = sc.nextInt();
				array[i].add(yy);
				presentnumber.add(yy);
			}
		}
		ArrayList<Node> lista = new ArrayList<Node>();
		for(int e:  presentnumber){
			Node node = new Node(e, N - 1);
			for(int i = 0; i < amount; i++)
				if (array[i].contains(e))
					node.add(i);
			node.ready();
			lista.add(node);
		}
		Collections.sort(lista);
		int last = 0;
		for(int i = 0; i < lista.size(); i++){
			if ((i == lista.size() - 1) || (comparar(lista.get(i), lista.get(i + 1)) == 0))
				continue;
			StringBuilder sb = new StringBuilder();
			sb.append((i - last + 1)+"");
			for(int j = last; j <= i; j++)
				sb.append(" "+lista.get(j).n);
			last = i + 1;
			System.out.println(sb.toString());
		}
		if (lista.size()- last>0){
			StringBuilder sb = new StringBuilder();
			sb.append((lista.size() - last)+"");
			for(int j = last; j < lista.size(); j++)
				sb.append(" "+lista.get(j).n);
			System.out.println(sb.toString());
		}
	}

}


//package yandex_qual_2;

import java.util.*;
public class B
{
	public static Set<Integer> s[];
	public static int n, p[][],nn;
	public static void main(String[] args)
	{
		Scanner inp = new Scanner(System.in);
		n = inp.nextInt();
		nn = n*(n-1)/2;
		p = new int[nn][201];
		s = new HashSet[n];
		for(int i = 0 ; i < nn ; i++)
		{
			p[i][0] = inp.nextInt();
			for(int j = 1 ; j <= p[i][0] ; j++)
				p[i][j] = inp.nextInt();
		}
		for(int i = 0 ; i < n ; i++)
		{
			s[i] = new HashSet<Integer>();
		}

		int ind = 0;
		for(int i = 0 ; i < nn-1 && ind < n; i++)
		{
			Set<Integer> s1 = new HashSet<Integer>();
			for(int k = 1 ; k <= p[i][0] ; k++)
				s1.add(p[i][k]);
			for(int j = i+1 ; j < nn && ind < n; j++)
			{
				Set<Integer> s2 = new HashSet<Integer>();
				for(int k = 1 ; k <= p[j][0] ; k++)
					s2.add(p[j][k]);

				s[ind].clear();
				s[ind].addAll(s1);
				s[ind].removeAll(s2);
				boolean rep = false;
				for(int k = 0 ; k < ind ; k++)if(s[k].contains(s[ind].toArray()[0])){rep = true;break;}

				if(!rep)ind++;
				if(ind == n) break;
				s[ind].clear();
				s[ind].addAll(s2);
				s[ind].removeAll(s1);
				rep = false;
				for(int k = 0 ; k < ind ; k++)if(s[k].contains(s[ind].toArray()[0])){rep = true;break;}
				if(!rep)ind++;

//				s[ind].clear();
//				s[ind].addAll(s2);
//				s[ind].removeAll(s1);
//				rep = false;
//				for(int k = 0 ; k < ind ; k++)if(s[k].contains(s[ind].toArray()[0])){rep = true;break;}
//				if(!rep)ind++;

			}
		}
		if(n==2)
		{
			s[0].add(p[0][1]);
			s[1].add(p[0][2]);
		}

		for(int i = 0 ; i < n ; i++)
		{
			String ans = "";
			System.out.print(s[i].size() + " ");
			for(Integer I : s[i])
				ans+= String.valueOf(I+" ");
			System.out.println(ans.trim());
		}

	}

}


//package yandex_qual_2;

import java.util.*;
public class B
{
	public static Set<Integer> s[];
	public static int n, p[][],nn;
	public static void main(String[] args)
	{
		Scanner inp = new Scanner(System.in);
		n = inp.nextInt();
		nn = n*(n-1)/2;
		p = new int[nn][201];
		s = new HashSet[n];
		for(int i = 0 ; i < nn ; i++)
		{
			p[i][0] = inp.nextInt();
			for(int j = 1 ; j <= p[i][0] ; j++)
				p[i][j] = inp.nextInt();
		}
		for(int i = 0 ; i < n ; i++)
		{
			s[i] = new HashSet<Integer>();
		}

		int ind = 0;
		for(int i = 0 ; i < nn-1 && ind < n; i++)
		{
			Set<Integer> s1 = new HashSet<Integer>();
			for(int k = 1 ; k <= p[i][0] ; k++)
				s1.add(p[i][k]);
			for(int j = i+1 ; j < nn && ind < n; j++)
			{
				Set<Integer> s2 = new HashSet<Integer>();
				for(int k = 1 ; k <= p[j][0] ; k++)
					s2.add(p[j][k]);

				s[ind].clear();
				s[ind].addAll(s1);
				s[ind].removeAll(s2);
				boolean rep = false;
				for(int k = 0 ; k < ind ; k++)if(s[k].contains(s[ind].toArray()[0])){rep = true;break;}

				if(!rep)ind++;
				if(ind == n) break;
				s[ind].clear();
				s[ind].addAll(s2);
				s[ind].removeAll(s1);
				rep = false;
				for(int k = 0 ; k < ind ; k++)if(s[k].contains(s[ind].toArray()[0])){rep = true;break;}
				if(!rep)ind++;

//				s[ind].clear();
//				s[ind].addAll(s2);
//				s[ind].removeAll(s1);
//				rep = false;
//				for(int k = 0 ; k < ind ; k++)if(s[k].contains(s[ind].toArray()[0])){rep = true;break;}
//				if(!rep)ind++;

			}
		}

		for(int i = 0 ; i < n ; i++)
		{
			String ans = "";
			System.out.print(s[i].size() + " ");
			for(Integer I : s[i])
				ans+= String.valueOf(I+" ");
			System.out.println(ans.trim());
		}

	}

}


//package yandex_qual_2;

import java.util.*;
public class B
{
	public static Set<Integer> s[];
	public static int n, p[][],nn;
	public static void main(String[] args)
	{
		Scanner inp = new Scanner(System.in);
		n = inp.nextInt();
		nn = n*(n-1)/2;
		p = new int[nn][201];
		s = new HashSet[n];
		for(int i = 0 ; i < nn ; i++)
		{
			p[i][0] = inp.nextInt();
			for(int j = 1 ; j <= p[i][0] ; j++)
				p[i][j] = inp.nextInt();
		}
		for(int i = 0 ; i < n ; i++)
		{
			s[i] = new HashSet<Integer>();
		}

		int ind = 0;
		for(int i = 0 ; i < nn-1 && ind < n; i++)
		{
			Set<Integer> s1 = new HashSet<Integer>();
			for(int k = 1 ; k <= p[i][0] ; k++)
				s1.add(p[i][k]);
			for(int j = i+1 ; j < nn && ind < n; j++)
			{
				Set<Integer> s2 = new HashSet<Integer>();
				for(int k = 1 ; k <= p[j][0] ; k++)
					s2.add(p[j][k]);

				s[ind].clear();
				s[ind].addAll(s1);
				s[ind].removeAll(s2);
				boolean rep = false;
				for(int k = 0 ; k < ind ; k++)if(s[k].contains(s[ind].toArray()[0])){rep = true;break;}

				if(!rep)ind++;
				if(ind == n) break;
				s[ind].clear();
				s[ind].addAll(s2);
				s[ind].removeAll(s1);
				rep = false;
				for(int k = 0 ; k < ind ; k++)if(s[k].contains(s[ind].toArray()[0])){rep = true;break;}
				if(!rep)ind++;

//				s[ind].clear();
//				s[ind].addAll(s2);
//				s[ind].removeAll(s1);
//				rep = false;
//				for(int k = 0 ; k < ind ; k++)if(s[k].contains(s[ind].toArray()[0])){rep = true;break;}
//				if(!rep)ind++;

			}
		}
		if(n==2)
		{
			s[0].add(p[0][1]);
			for(int i = 2 ; i <= p[0][0] ; i++)s[1].add(p[0][i]);
		}

		for(int i = 0 ; i < n ; i++)
		{
			String ans = "";
			System.out.print(s[i].size() + " ");
			for(Integer I : s[i])
				ans+= String.valueOf(I+" ");
			System.out.println(ans.trim());
		}

	}

}


//package yandex_qual_2;

import java.util.*;
public class B
{
	public static Set<Integer> s[];
	public static int n, p[][],nn;
	public static void main(String[] args)
	{
		Scanner inp = new Scanner(System.in);
		n = inp.nextInt();
		nn = n*(n-1)/2;
		p = new int[nn][201];
		s = new HashSet[n];
		for(int i = 0 ; i < nn ; i++)
		{
			p[i][0] = inp.nextInt();
			for(int j = 1 ; j <= p[i][0] ; j++)
				p[i][j] = inp.nextInt();
		}
		for(int i = 0 ; i < n ; i++)
		{
			s[i] = new HashSet<Integer>();
		}

		int ind = 0;
		for(int i = 0 ; i < nn-1 && ind < n; i++)
		{
			Set<Integer> s1 = new HashSet<Integer>();
			for(int k = 1 ; k <= p[i][0] ; k++)
				s1.add(p[i][k]);
			for(int j = i+1 ; j < nn && ind < n; j++)
			{
				Set<Integer> s2 = new HashSet<Integer>();
				for(int k = 1 ; k <= p[j][0] ; k++)
					s2.add(p[j][k]);

				s[ind].clear();
				s[ind].addAll(s1);
				s[ind].removeAll(s2);
				boolean rep = false;
				for(int k = 0 ; k < ind ; k++)if(s[k].contains(s[ind].toArray()[0])){rep = true;break;}

				if(!rep)ind++;
				if(ind == n) break;
				s[ind].clear();
				s[ind].addAll(s2);
				s[ind].removeAll(s1);
				rep = false;
				for(int k = 0 ; k < ind ; k++)if(s[k].contains(s[ind].toArray()[0])){rep = true;break;}
				if(!rep)ind++;

//				s[ind].clear();
//				s[ind].addAll(s2);
//				s[ind].removeAll(s1);
//				rep = false;
//				for(int k = 0 ; k < ind ; k++)if(s[k].contains(s[ind].toArray()[0])){rep = true;break;}
//				if(!rep)ind++;

			}
		}
		if(n==1)
		{
			for(int k = 1 ; k <= p[0][0] ; k++)
				s[0].add(p[0][k]);
		}

		for(int i = 0 ; i < n ; i++)
		{
			String ans = "";
			System.out.print(s[i].size() + " ");
			for(Integer I : s[i])
				ans+= String.valueOf(I+" ");
			System.out.println(ans.trim());
		}

	}

}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Prob082B
{
    public static void main( String[] Args )
    {
        Scanner scan = new Scanner( System.in );
        int papers = scan.nextInt();
        int[][] combos = new int[papers * ( papers - 1 ) / 2][];
        for ( int i = 0; i < combos.length; i++ )
        {
            combos[i] = new int[scan.nextInt()];
            for ( int j = 0; j < combos[i].length; j++ )
                combos[i][j] = scan.nextInt();
            Arrays.sort( combos[i] );
        }

        ArrayList<Integer> foundItems = new ArrayList<Integer>();
        ArrayList<Integer>[] al = new ArrayList[papers];
        for ( int i = 0; i < papers; i++ )
            al[i] = new ArrayList<Integer>();
        int papersFound = 0;

        for ( int i = 0; i < combos.length; i++ )
            for ( int j = 0; j < i; j++ )
            {
                boolean overlap = false;
                for ( int k = 0; k < combos[i].length; k++ )
                {
                    if ( Arrays.binarySearch( combos[j], combos[i][k] ) >= 0
                        && Collections.binarySearch( foundItems, combos[i][k] ) < 0 )
                    {
                        al[papersFound].add( combos[i][k] );
                        foundItems.add( combos[i][k] );
                        overlap = true;
                    }
                }
                if ( overlap )
                {
                    papersFound++;
                    Collections.sort( foundItems );
                }
            }

        for ( int i = 0; i < al.length; i++ )
        {
            System.out.print( al[i].size() );
            for ( int j = 0; j < al[i].size(); j++ )
                System.out.print( " " + al[i].get( j ) );
            System.out.println();
        }
    }
}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Prob082B
{
    public static void main( String[] Args )
    {
        Scanner scan = new Scanner( System.in );
        int numPaper = scan.nextInt();
        if ( numPaper == 2 )
        {
            int length = scan.nextInt();
            System.out.println( 1 + " " + scan.nextInt() );
            System.out.print( length - 1 );
            for ( int y = 0; y < length - 1; y++ )
                System.out.print( " " + scan.nextInt() );
        }
        else
        {
            int[][] combos = new int[numPaper * ( numPaper - 1 ) / 2][];
            int min = 100000;
            int minI = 0;
            int minI2 = -1;
            for ( int i = 0; i < combos.length; i++ )
            {
                combos[i] = new int[scan.nextInt()];

                for ( int j = 0; j < combos[i].length; j++ )
                    combos[i][j] = scan.nextInt();

                Arrays.sort( combos[i] );

                if ( combos[i][0] < min )
                {
                    min = combos[i][0];
                    minI = i;
                    minI2 = -1;
                }
                else if ( combos[i][0] == min && minI2 == -1 )
                    minI2 = i;
            }

            ArrayList<Integer> slip = new ArrayList<Integer>();
            for ( int x = 0; x < combos[minI].length; x++ )
                if ( Arrays.binarySearch( combos[minI2], combos[minI][x] ) >= 0 )
                    slip.add( combos[minI][x] );

            int[][] paper = new int[numPaper - 1][];
            int papersFound = 0;

            int size = slip.size();

            for ( int i = 0; i < combos.length; i++ )
                if ( combos[i][0] == min )
                {
                    paper[papersFound] = new int[combos[i].length - size];
                    int numbersFound = 0;
                    int slipIndex = 0;

                    for ( int j = 0; j < combos[i].length; j++ )
                        if ( slipIndex < size && combos[i][j] == slip.get( slipIndex ) )
                            slipIndex++;
                        else
                            paper[papersFound][numbersFound++] = combos[i][j];

                    papersFound++;
                }

            System.out.print( slip.size() );
            for ( int i = 0; i < slip.size(); i++ )
                System.out.print( " " + slip.get( i ) );
            System.out.println();

            for ( int i = 0; i < paper.length; i++ )
            {
                System.out.print( paper[i].length );
                for ( int j = 0; j < paper[i].length; j++ )
                    System.out.print( " " + paper[i][j] );
                System.out.println();
            }
        }
    }
}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Prob082B
{
    public static void main( String[] Args )
    {
        Scanner scan = new Scanner( System.in );
        int numPaper = scan.nextInt();
        if ( numPaper == 2 )
        {
            int length = scan.nextInt();
            System.out.println( 1 + " " + scan.nextInt() );
            System.out.print( length - 1 );
            for ( int y = 0; y < length - 1; y++ )
                System.out.print( " " + scan.nextInt() );
        }
        else
        {
            int[][] combos = new int[numPaper * ( numPaper - 1 ) / 2][];
            int min = 10000;
            int minI = 0;
            int minI2 = -1;
            for ( int i = 0; i < combos.length; i++ )
            {
                combos[i] = new int[scan.nextInt()];
                for ( int j = 0; j < combos[i].length; j++ )
                    combos[i][j] = scan.nextInt();
                Arrays.sort( combos[i] );

                if ( combos[i][0] < min )
                {
                    min = combos[i][0];
                    minI = i;
                }
                else if ( combos[i][0] == min && minI2 == -1 )
                    minI2 = i;
            }

            ArrayList<Integer> slip = new ArrayList<Integer>();
            for ( int x = 0; x < combos[minI].length; x++ )
                if ( Arrays.binarySearch( combos[minI2], combos[minI][x] ) >= 0 )
                    slip.add( combos[minI][x] );

            int[][] paper = new int[numPaper - 1][];
            int papersFound = 0;

            int size = slip.size();

            for ( int i = 0; i < combos.length; i++ )
                if ( combos[i][0] == min )
                {
                    paper[papersFound] = new int[combos[i].length - size];
                    int numbersFound = 0;
                    int slipIndex = 0;

                    for ( int j = 0; j < combos[i].length; j++ )
                        if ( slipIndex < size && combos[i][j] == slip.get( slipIndex ) )
                            slipIndex++;
                        else
                            paper[papersFound][numbersFound++] = combos[i][j];

                    papersFound++;
                }

            System.out.print( slip.size() );
            for ( int i = 0; i < slip.size(); i++ )
                System.out.print( " " + slip.get( i ) );
            System.out.println();

            for ( int i = 0; i < paper.length; i++ )
            {
                System.out.print( paper[i].length );
                for ( int j = 0; j < paper[i].length; j++ )
                    System.out.print( " " + paper[i][j] );
                System.out.println();
            }
        }
    }
}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Scanner;

public class Prob082B
{
    public static void main( String[] Args )
    {
        Scanner scan = new Scanner( System.in );
        int numPaper = scan.nextInt();
        if ( numPaper == 2 )
        {
            int length = scan.nextInt();
            System.out.println( 1 + " " + scan.nextInt() );
            System.out.print( length - 1 );
            for ( int y = 0; y < length - 1; y++ )
                System.out.print( " " + scan.nextInt() );
        }
        else
        {
            int[][] combos = new int[numPaper * ( numPaper - 1 ) / 2][];
            int min = 10000;
            int minI = 0;
            int minI2 = 0;
            for ( int i = 0; i < combos.length; i++ )
            {
                combos[i] = new int[scan.nextInt()];
                for ( int j = 0; j < combos[i].length; j++ )
                    combos[i][j] = scan.nextInt();
                Arrays.sort( combos[i] );
                if ( combos[i][0] < min )
                {
                    min = combos[i][0];
                    minI = i;
                }
                else if ( combos[i][0] == min && minI2 == 0 )
                    minI2 = i;
            }

            ArrayList<Integer> slip = new ArrayList<Integer>();
            for ( int x = 0; x < combos[minI].length; x++ )
                if ( Arrays.binarySearch( combos[minI2], combos[minI][x] ) >= 0 )
                    slip.add( combos[minI][x] );

            int[][] paper = new int[numPaper - 1][];
            int papersFound = 0;

            int size = slip.size();

            for ( int i = 0; i < combos.length; i++ )
                if ( combos[i][0] == min )
                {
                    paper[papersFound] = new int[combos[i].length - size];
                    int numbersFound = 0;
                    int slipIndex = 0;

                    for ( int j = 0; j < combos[i].length; j++ )
                        if ( slipIndex < size && combos[i][j] == slip.get( slipIndex ) )
                            slipIndex++;
                        else
                            paper[papersFound][numbersFound++] = combos[i][j];

                    papersFound++;
                }

            System.out.print( slip.size() );
            for ( int i = 0; i < slip.size(); i++ )
                System.out.print( " " + slip.get( i ) );
            System.out.println();

            for ( int i = 0; i < paper.length; i++ )
            {
                System.out.print( paper[i].length );
                for ( int j = 0; j < paper[i].length; j++ )
                    System.out.print( " " + paper[i][j] );
                System.out.println();
            }
        }
    }
}


import java.util.*;
import java.io.*;
public class Yan2B{
    static BufferedReader br;
    public static void main(String args[])throws Exception{
        br=new BufferedReader(new InputStreamReader(System.in));
        int n=toInt();
        ArrayList<Integer> ar[]=new ArrayList[n*(n-1)/2];
        int numElem[]=new int[n*(n-1)/2];
        int in[]=new int[n];
        for(int i=0;i<n*(n-1)/2;i++){
            in=toIntArray();
            ar[i]=new ArrayList();
            numElem[i]=in[0];
            for(int j=0;j<in[0];j++){
                ar[i].add(in[j+1]);
            }
            Collections.sort(ar[i]);
        }
        ArrayList<Integer> temp=new ArrayList();
        Set s[]=new TreeSet[n];
        int c=0;
        int cc=0;
        boolean fff=false;
        int nums[]=new int[n*(n-1)/2];
        for(int i=0;i<n*(n-1)/2;i++){
            for(int kk=0;kk<cc;kk++){
                if(nums[kk]==i){
                    fff=true;
                    break;
                }
            }
            //System.out.println("================== i: "+i);

            if(!fff){
            for(int j=0;j<n*(n-1)/2;j++){
                if(i!=j){

                    if(ar[i].get(0)==ar[j].get(0)){
                        //System.out.println(" i: "+i+" equals j:"+j);
                        int x=0;
                        while(ar[i].get(x)==ar[j].get(x)){
                            x++;
                        }
                        Set t1=new TreeSet();
                        Set t2=new TreeSet();
                        Set t3=new TreeSet();

                        //System.out.println("x is: "+x);
                        for(int y=0;y<x;y++){
                            t1.add(ar[i].get(y));
                        }
                        int t=ar[i].size();
                        for(int y=x;y<t;y++){
                            t2.add(ar[i].get(y));
                        }
                        t=ar[j].size();
                        for(int y=x;y<t;y++){
                            t3.add(ar[j].get(y));
                        }
                        boolean f1=false;
                        boolean f2=false;
                        boolean f3=false;

                        for(int q=0;q<c;q++){
                            if(s[q].equals(t1)){
                                f1=true;
                                break;
                            }
                            else{
                                Iterator it=t1.iterator();
                                while(it.hasNext()){
                                    if(s[q].contains(it.next())){
                                        f1=true;
                                        break;
                                    }
                                }
                            }
                        }

                        //System.out.println("c: "+c);
                        if(!f1){
                            s[c]=new TreeSet();
                            s[c].addAll(t1);

                            c++;
                        }

                        for(int q=0;q<c;q++){
                            if(s[q].equals(t2)){
                                f2=true;
                                break;
                            }
                            else{
                                Iterator it=t2.iterator();
                                while(it.hasNext()){
                                    if(s[q].contains(it.next())){
                                        f2=true;
                                        break;
                                    }
                                }
                            }
                        }

                        if(!f2){
                            s[c]=new TreeSet();
                            s[c].addAll(t2);
                            c++;
                        }

                        for(int q=0;q<c;q++){
                            if(s[q].equals(t3)){
                                f3=true;
                                break;
                            }
                            else{
                                Iterator it=t3.iterator();
                                while(it.hasNext()){
                                    if(s[q].contains(it.next())){
                                        f3=true;
                                        break;
                                    }
                                }
                            }
                        }

                        if(!f3){
                            s[c]=new TreeSet();
                            s[c].addAll(t3);
                            c++;
                        }

                        nums[cc++]=i;
                        nums[cc++]=j;

                        break;
                    }
                }
            }
        }
        }

        Iterator itr;
        for(int i=0;i<c;i++){
            System.out.print(s[i].size());
            itr=s[i].iterator();
            while(itr.hasNext()){
                System.out.print(" "+itr.next());
            }
            System.out.println();
        }

    }

    /****************************************************************/
    public static int[] toIntArray()throws Exception{
       String str[]=br.readLine().split(" ");
       int k[]=new int[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Integer.parseInt(str[i]);
       }
       return k;
    }
    public static int toInt()throws Exception{
       return Integer.parseInt(br.readLine());
    }
    public static long[] toLongArray()throws Exception{
       String str[]=br.readLine().split(" ");
       long k[]=new long[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Long.parseLong(str[i]);
       }
       return k;
    }
    public static long toLong()throws Exception{
       return Long.parseLong(br.readLine());
    }
    public static double[] toDoubleArray()throws Exception{
       String str[]=br.readLine().split(" ");
       double k[]=new double[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Double.parseDouble(str[i]);
       }
       return k;
    }
    public static double toDouble()throws Exception{
       return Double.parseDouble(br.readLine());
    }
    public static String toStr()throws Exception{
       return br.readLine();
    }
    public static String[] toStrArray()throws Exception{
       String str[]=br.readLine().split(" ");
       return str;
    }
    /****************************************************************/

}


import java.util.*;
import java.io.*;
public class Yan2B{
    static BufferedReader br;
    public static void main(String args[])throws Exception{
        br=new BufferedReader(new InputStreamReader(System.in));
        int n=toInt();
        ArrayList<Integer> ar[]=new ArrayList[n*(n-1)/2];
        int numElem[]=new int[n*(n-1)/2];
        int in[]=new int[n];
        for(int i=0;i<n*(n-1)/2;i++){
            in=toIntArray();
            ar[i]=new ArrayList();
            numElem[i]=in[0];
            for(int j=0;j<in[0];j++){
                ar[i].add(in[j+1]);
            }
            Collections.sort(ar[i]);
        }
        ArrayList<Integer> temp=new ArrayList();
        Set s[]=new TreeSet[n];
        int c=0;
        int cc=0;
        boolean fff=false;
        int nums[]=new int[n*(n-1)];
        for(int i=0;i<n*(n-1)/2;i++){
            fff=false;
            for(int kk=0;kk<cc;kk++){
                if(nums[kk]==i){
                    fff=true;
                    break;
                }
            }
            //System.out.println("================== i: "+i);

            if(!fff){
            for(int j=0;j<n*(n-1)/2;j++){
                if(i!=j){

                    if(ar[i].get(0)==ar[j].get(0)){
                        //System.out.println(" i: "+i+" equals j:"+j);
                        int x=0;
                        while(ar[i].get(x)==ar[j].get(x)){
                            x++;
                        }
                        Set t1=new TreeSet();
                        Set t2=new TreeSet();
                        Set t3=new TreeSet();

                        //System.out.println("x is: "+x);
                        for(int y=0;y<x;y++){
                            t1.add(ar[i].get(y));
                        }
                        int t=ar[i].size();
                        for(int y=x;y<t;y++){
                            t2.add(ar[i].get(y));
                        }
                        t=ar[j].size();
                        for(int y=x;y<t;y++){
                            t3.add(ar[j].get(y));
                        }
                        boolean f1=false;
                        boolean f2=false;
                        boolean f3=false;

                        for(int q=0;q<c;q++){
                            if(s[q].equals(t1)){
                                f1=true;
                                break;
                            }
                            else{
                                Iterator it=t1.iterator();
                                while(it.hasNext()){
                                    if(s[q].contains(it.next())){
                                        f1=true;
                                        break;
                                    }
                                }
                            }
                        }

                        //System.out.println("c: "+c);
                        if(!f1){
                            s[c]=new TreeSet();
                            s[c].addAll(t1);

                            c++;
                        }

                        for(int q=0;q<c;q++){
                            if(s[q].equals(t2)){
                                f2=true;
                                break;
                            }
                            else{
                                Iterator it=t2.iterator();
                                while(it.hasNext()){
                                    if(s[q].contains(it.next())){
                                        f2=true;
                                        break;
                                    }
                                }
                            }
                        }

                        if(!f2){
                            s[c]=new TreeSet();
                            s[c].addAll(t2);
                            c++;
                        }

                        for(int q=0;q<c;q++){
                            if(s[q].equals(t3)){
                                f3=true;
                                break;
                            }
                            else{
                                Iterator it=t3.iterator();
                                while(it.hasNext()){
                                    if(s[q].contains(it.next())){
                                        f3=true;
                                        break;
                                    }
                                }
                            }
                        }

                        if(!f3){
                            s[c]=new TreeSet();
                            s[c].addAll(t3);
                            c++;
                        }

                        nums[cc++]=i;
                        nums[cc++]=j;

                        break;
                    }
                }
            }
        }
        }

        Iterator itr;
        for(int i=0;i<c;i++){
            System.out.print(s[i].size());
            itr=s[i].iterator();
            while(itr.hasNext()){
                System.out.print(" "+itr.next());
            }
            System.out.println();
        }

    }

    /****************************************************************/
    public static int[] toIntArray()throws Exception{
       String str[]=br.readLine().split(" ");
       int k[]=new int[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Integer.parseInt(str[i]);
       }
       return k;
    }
    public static int toInt()throws Exception{
       return Integer.parseInt(br.readLine());
    }
    public static long[] toLongArray()throws Exception{
       String str[]=br.readLine().split(" ");
       long k[]=new long[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Long.parseLong(str[i]);
       }
       return k;
    }
    public static long toLong()throws Exception{
       return Long.parseLong(br.readLine());
    }
    public static double[] toDoubleArray()throws Exception{
       String str[]=br.readLine().split(" ");
       double k[]=new double[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Double.parseDouble(str[i]);
       }
       return k;
    }
    public static double toDouble()throws Exception{
       return Double.parseDouble(br.readLine());
    }
    public static String toStr()throws Exception{
       return br.readLine();
    }
    public static String[] toStrArray()throws Exception{
       String str[]=br.readLine().split(" ");
       return str;
    }
    /****************************************************************/

}


import java.util.*;
import java.io.*;
public class Yan2B{
    static BufferedReader br;
    public static void main(String args[])throws Exception{
        br=new BufferedReader(new InputStreamReader(System.in));
        int n=toInt();
        ArrayList<Integer> ar[]=new ArrayList[n*(n-1)/2];
        int numElem[]=new int[n*(n-1)/2];
        int in[]=new int[n];
        for(int i=0;i<n*(n-1)/2;i++){
            in=toIntArray();
            ar[i]=new ArrayList();
            numElem[i]=in[0];
            for(int j=0;j<in[0];j++){
                ar[i].add(in[j+1]);
            }
            Collections.sort(ar[i]);
        }
        ArrayList<Integer> temp=new ArrayList();
        Set s[]=new TreeSet[n];
        int c=0;
        int cc=0;
        boolean fff=false;
        int nums[]=new int[n*(n-1)/2];
        for(int i=0;i<n*(n-1)/2;i++){
            fff=false;
            for(int kk=0;kk<cc;kk++){
                if(nums[kk]==i){
                    fff=true;
                    break;
                }
            }
            //System.out.println("================== i: "+i);

            if(!fff){
            for(int j=0;j<n*(n-1)/2;j++){
                if(i!=j){

                    if(ar[i].get(0)==ar[j].get(0)){
                        //System.out.println(" i: "+i+" equals j:"+j);
                        int x=0;
                        while(ar[i].get(x)==ar[j].get(x)){
                            x++;
                        }
                        Set t1=new TreeSet();
                        Set t2=new TreeSet();
                        Set t3=new TreeSet();

                        //System.out.println("x is: "+x);
                        for(int y=0;y<x;y++){
                            t1.add(ar[i].get(y));
                        }
                        int t=ar[i].size();
                        for(int y=x;y<t;y++){
                            t2.add(ar[i].get(y));
                        }
                        t=ar[j].size();
                        for(int y=x;y<t;y++){
                            t3.add(ar[j].get(y));
                        }
                        boolean f1=false;
                        boolean f2=false;
                        boolean f3=false;

                        for(int q=0;q<c;q++){
                            if(s[q].equals(t1)){
                                f1=true;
                                break;
                            }
                            else{
                                Iterator it=t1.iterator();
                                while(it.hasNext()){
                                    if(s[q].contains(it.next())){
                                        f1=true;
                                        break;
                                    }
                                }
                            }
                        }

                        //System.out.println("c: "+c);
                        if(!f1){
                            s[c]=new TreeSet();
                            s[c].addAll(t1);

                            c++;
                        }

                        for(int q=0;q<c;q++){
                            if(s[q].equals(t2)){
                                f2=true;
                                break;
                            }
                            else{
                                Iterator it=t2.iterator();
                                while(it.hasNext()){
                                    if(s[q].contains(it.next())){
                                        f2=true;
                                        break;
                                    }
                                }
                            }
                        }

                        if(!f2){
                            s[c]=new TreeSet();
                            s[c].addAll(t2);
                            c++;
                        }

                        for(int q=0;q<c;q++){
                            if(s[q].equals(t3)){
                                f3=true;
                                break;
                            }
                            else{
                                Iterator it=t3.iterator();
                                while(it.hasNext()){
                                    if(s[q].contains(it.next())){
                                        f3=true;
                                        break;
                                    }
                                }
                            }
                        }

                        if(!f3){
                            s[c]=new TreeSet();
                            s[c].addAll(t3);
                            c++;
                        }

                        nums[cc++]=i;
                        nums[cc++]=j;

                        break;
                    }
                }
            }
        }
        }

        Iterator itr;
        for(int i=0;i<c;i++){
            System.out.print(s[i].size());
            itr=s[i].iterator();
            while(itr.hasNext()){
                System.out.print(" "+itr.next());
            }
            System.out.println();
        }

    }

    /****************************************************************/
    public static int[] toIntArray()throws Exception{
       String str[]=br.readLine().split(" ");
       int k[]=new int[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Integer.parseInt(str[i]);
       }
       return k;
    }
    public static int toInt()throws Exception{
       return Integer.parseInt(br.readLine());
    }
    public static long[] toLongArray()throws Exception{
       String str[]=br.readLine().split(" ");
       long k[]=new long[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Long.parseLong(str[i]);
       }
       return k;
    }
    public static long toLong()throws Exception{
       return Long.parseLong(br.readLine());
    }
    public static double[] toDoubleArray()throws Exception{
       String str[]=br.readLine().split(" ");
       double k[]=new double[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Double.parseDouble(str[i]);
       }
       return k;
    }
    public static double toDouble()throws Exception{
       return Double.parseDouble(br.readLine());
    }
    public static String toStr()throws Exception{
       return br.readLine();
    }
    public static String[] toStrArray()throws Exception{
       String str[]=br.readLine().split(" ");
       return str;
    }
    /****************************************************************/

}


import java.util.*;
import java.io.*;
public class Yan2B{
    static BufferedReader br;
    public static void main(String args[])throws Exception{
        br=new BufferedReader(new InputStreamReader(System.in));
        int n=toInt();
        ArrayList<Integer> ar[]=new ArrayList[n*(n-1)/2];
        int numElem[]=new int[n*(n-1)/2];
        int in[]=new int[n];
        for(int i=0;i<n*(n-1)/2;i++){
            in=toIntArray();
            ar[i]=new ArrayList();
            numElem[i]=in[0];
            for(int j=0;j<in[0];j++){
                ar[i].add(in[j+1]);
            }
            Collections.sort(ar[i]);
        }
        ArrayList<Integer> temp=new ArrayList();
        Set s[]=new TreeSet[n];
        int c=0;
        int cc=0;
        boolean fff=false;
        int nums[]=new int[n*(n-1)];
        for(int i=0;i<n*(n-1)/2;i++){
            /*fff=false;
            for(int kk=0;kk<cc;kk++){
                if(nums[kk]==i){
                    fff=true;
                    break;
                }
            }
             *
             */
            //System.out.println("================== i: "+i);

            //if(!fff){
            for(int j=0;j<n*(n-1)/2;j++){
                if(i!=j){

                    if(ar[i].get(0)==ar[j].get(0)){
                        //System.out.println(" i: "+i+" equals j:"+j);
                        int x=0;
                        while(ar[i].get(x)==ar[j].get(x)){
                            x++;
                        }
                        Set t1=new TreeSet();
                        Set t2=new TreeSet();
                        //Set t3=new TreeSet();

                        //System.out.println("x is: "+x);
                        for(int y=0;y<x;y++){
                            t1.add(ar[i].get(y));
                        }
                        int t=ar[i].size();
                        for(int y=x;y<t;y++){
                            t2.add(ar[i].get(y));
                        }
                        //t=ar[j].size();
                        //for(int y=x;y<t;y++){
                        //    t3.add(ar[j].get(y));
                        //}
                        boolean f1=false;
                        boolean f2=false;
                        //boolean f3=false;

                        for(int q=0;q<c;q++){
                            if(s[q].equals(t1)){
                                f1=true;
                                break;
                            }
                            else{
                                Iterator it=t1.iterator();
                                while(it.hasNext()){
                                    if(s[q].contains(it.next())){
                                        f1=true;
                                        break;
                                    }
                                }
                            }
                        }

                        //System.out.println("c: "+c);
                        if(!f1){
                            s[c]=new TreeSet();
                            s[c].addAll(t1);

                            c++;
                        }

                        for(int q=0;q<c;q++){
                            if(s[q].equals(t2)){
                                f2=true;
                                break;
                            }
                            else{
                                Iterator it=t2.iterator();
                                while(it.hasNext()){
                                    if(s[q].contains(it.next())){
                                        f2=true;
                                        break;
                                    }
                                }
                            }
                        }

                        if(!f2){
                            s[c]=new TreeSet();
                            s[c].addAll(t2);
                            c++;
                        }

                        /*
                        for(int q=0;q<c;q++){
                            if(s[q].equals(t3)){
                                f3=true;
                                break;
                            }
                            else{
                                Iterator it=t3.iterator();
                                while(it.hasNext()){
                                    if(s[q].contains(it.next())){
                                        f3=true;
                                        break;
                                    }
                                }
                            }
                        }

                        if(!f3){
                            s[c]=new TreeSet();
                            s[c].addAll(t3);
                            c++;
                        }

                        nums[cc++]=i;
                        nums[cc++]=j;
                         *
                         */

                        break;
                    }
                }
            }
        //}
        }

        Iterator itr;
        for(int i=0;i<c;i++){
            System.out.print(s[i].size());
            itr=s[i].iterator();
            while(itr.hasNext()){
                System.out.print(" "+itr.next());
            }
            System.out.println();
        }

    }

    /****************************************************************/
    public static int[] toIntArray()throws Exception{
       String str[]=br.readLine().split(" ");
       int k[]=new int[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Integer.parseInt(str[i]);
       }
       return k;
    }
    public static int toInt()throws Exception{
       return Integer.parseInt(br.readLine());
    }
    public static long[] toLongArray()throws Exception{
       String str[]=br.readLine().split(" ");
       long k[]=new long[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Long.parseLong(str[i]);
       }
       return k;
    }
    public static long toLong()throws Exception{
       return Long.parseLong(br.readLine());
    }
    public static double[] toDoubleArray()throws Exception{
       String str[]=br.readLine().split(" ");
       double k[]=new double[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Double.parseDouble(str[i]);
       }
       return k;
    }
    public static double toDouble()throws Exception{
       return Double.parseDouble(br.readLine());
    }
    public static String toStr()throws Exception{
       return br.readLine();
    }
    public static String[] toStrArray()throws Exception{
       String str[]=br.readLine().split(" ");
       return str;
    }
    /****************************************************************/

}


import java.util.*;
import java.io.*;
public class Yan2B{
    static BufferedReader br;
    public static void main(String args[])throws Exception{
        br=new BufferedReader(new InputStreamReader(System.in));
        int n=toInt();
        int tot=n*(n-1)/2;
        int nn[];
        int ar[][]=new int[tot][];

        for(int i=0;i<tot;i++){
            nn=toIntArray();
            ar[i]=new int[nn[0]];
            for(int j=0;j<nn[0];j++){
                ar[i][j]=nn[j+1];
            }
            Arrays.sort(ar[i]);
        }
        Arrays.sort(ar, new Com(0));

        if(n==2){
            System.out.println("1 "+ar[0][0]);
            System.out.print(ar[0].length-1);
            for(int p=1;p<ar[0].length;p++){
                System.out.print(" "+ar[0][p]);
            }
            System.out.println();
            return;
        }
        int i=0;
        int j=0;
        int con[]=new int[201];
        int c=0;
        while(i<ar[0].length && j<ar[j].length){
            if(ar[0][i]==ar[1][j]){
                con[c++]=ar[0][i];
                i++;
                j++;
            }
            else if(ar[0][i]>ar[1][j]){
                j++;
                if(j==ar[1].length){
                    break;
                }
            }
            else{
                i++;
                if(i==ar[0].length){
                    break;
                }
            }
        }

        int res[][]=new int[n][201];
        int len[]=new int[n];
        int cc=0;
        boolean f=false;
       for(j=0;j<n-1;j++){
           cc=0;
           for(int k=0;k<ar[j].length;k++){
               f=false;
               for(i=0;i<c;i++){
                    if(con[i]==ar[j][k]){
                        f=true;
                        break;

                    }
                }
               if(!f)
                   res[j][cc++]=ar[j][k];
           }
           len[j]=cc;
        }

        System.out.print(c);
        for(i=0;i<c;i++){
            System.out.print(" "+con[i]);
        }
        System.out.println();
        for(i=0;i<n-1;i++){
            System.out.print(len[i]);
            for(j=0;j<res[i].length;j++){
                if(res[i][j]==0) break;
                else
                    System.out.print(" "+res[i][j]);
            }
            System.out.println();
        }
    }

    /****************************************************************/
    public static int[] toIntArray()throws Exception{
       String str[]=br.readLine().split(" ");
       int k[]=new int[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Integer.parseInt(str[i]);
       }
       return k;
    }
    public static int toInt()throws Exception{
       return Integer.parseInt(br.readLine());
    }
    public static long[] toLongArray()throws Exception{
       String str[]=br.readLine().split(" ");
       long k[]=new long[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Long.parseLong(str[i]);
       }
       return k;
    }
    public static long toLong()throws Exception{
       return Long.parseLong(br.readLine());
    }
    public static double[] toDoubleArray()throws Exception{
       String str[]=br.readLine().split(" ");
       double k[]=new double[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Double.parseDouble(str[i]);
       }
       return k;
    }
    public static double toDouble()throws Exception{
       return Double.parseDouble(br.readLine());
    }
    public static String toStr()throws Exception{
       return br.readLine();
    }
    public static String[] toStrArray()throws Exception{
       String str[]=br.readLine().split(" ");
       return str;
    }
    /****************************************************************/

}

class Com implements Comparator {
   private int cm = 0;
    Com(int cm) {
        this.cm = cm;
    }
    public int compare(Object o1, Object o2) {
        int[] row1 = (int[])o1;
        int[] row2 = (int[])o2;
        int i;
        if (row1[cm]>row2[cm])
            i=1;
        else if(row1[cm]<row2[cm])
            i=-1;
        else i=0;
        return i;
    }
}


import java.util.*;
import java.io.*;
public class Yan2B{
    static BufferedReader br;
    public static void main(String args[])throws Exception{
        br=new BufferedReader(new InputStreamReader(System.in));
        int n=toInt();
        int tot=n*(n-1)/2;
        int nn[];
        int ar[][]=new int[tot][];

        for(int i=0;i<tot;i++){
            nn=toIntArray();
            ar[i]=new int[nn[0]];
            for(int j=0;j<nn[0];j++){
                ar[i][j]=nn[j+1];
            }
            Arrays.sort(ar[i]);
        }
        Arrays.sort(ar, new Com(0));

        if(n==2){
            System.out.println("1 "+ar[0][0]);
            System.out.print(ar[0].length-1);
            for(int p=1;p<ar[0].length;p++){
                System.out.print(" "+ar[0][p]);
            }
            System.out.println();
            return;
        }
        int i=0;
        int j=0;
        int con[]=new int[201];
        int c=0;
        while(i<ar[0].length && j<ar[1].length){
            if(ar[0][i]==ar[1][j]){
                con[c++]=ar[0][i];
                i++;
                j++;
            }
            else if(ar[0][i]>ar[1][j]){
                j++;
                if(j==ar[1].length){
                    break;
                }
            }
            else{
                i++;
                if(i==ar[0].length){
                    break;
                }
            }
        }

        int res[][]=new int[n][201];
        int len[]=new int[n];
        int cc=0;
        boolean f=false;
       for(j=0;j<n-1;j++){
           cc=0;
           for(int k=0;k<ar[j].length;k++){
               f=false;
               for(i=0;i<c;i++){
                    if(con[i]==ar[j][k]){
                        f=true;
                        break;

                    }
                }
               if(!f)
                   res[j][cc++]=ar[j][k];
           }
           len[j]=cc;
        }

        System.out.print(c);
        for(i=0;i<c;i++){
            System.out.print(" "+con[i]);
        }
        System.out.println();
        for(i=0;i<n-1;i++){
            System.out.print(len[i]);
            for(j=0;j<res[i].length;j++){
                if(res[i][j]==0) break;
                else
                    System.out.print(" "+res[i][j]);
            }
            System.out.println();
        }
    }

    /****************************************************************/
    public static int[] toIntArray()throws Exception{
       String str[]=br.readLine().split(" ");
       int k[]=new int[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Integer.parseInt(str[i]);
       }
       return k;
    }
    public static int toInt()throws Exception{
       return Integer.parseInt(br.readLine());
    }
    public static long[] toLongArray()throws Exception{
       String str[]=br.readLine().split(" ");
       long k[]=new long[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Long.parseLong(str[i]);
       }
       return k;
    }
    public static long toLong()throws Exception{
       return Long.parseLong(br.readLine());
    }
    public static double[] toDoubleArray()throws Exception{
       String str[]=br.readLine().split(" ");
       double k[]=new double[str.length];
       for(int i=0;i<str.length;i++){
            k[i]=Double.parseDouble(str[i]);
       }
       return k;
    }
    public static double toDouble()throws Exception{
       return Double.parseDouble(br.readLine());
    }
    public static String toStr()throws Exception{
       return br.readLine();
    }
    public static String[] toStrArray()throws Exception{
       String str[]=br.readLine().split(" ");
       return str;
    }
    /****************************************************************/

}

class Com implements Comparator {
   private int cm = 0;
    Com(int cm) {
        this.cm = cm;
    }
    public int compare(Object o1, Object o2) {
        int[] row1 = (int[])o1;
        int[] row2 = (int[])o2;
        int i;
        if (row1[cm]>row2[cm])
            i=1;
        else if(row1[cm]<row2[cm])
            i=-1;
        else i=0;
        return i;
    }
}


import java.io.*;
import java.util.*;

public class Solution implements Runnable {

	private StringTokenizer st;
	private BufferedReader in;
	private PrintWriter out;

	public void solve() throws IOException {
		int n = nextInt();
		int m = n * (n - 1) / 2;
		int[][] a = new int[m][];
		for (int i = 0; i < m; ++i) {
			a[i] = new int[nextInt()];
			for (int j = 0; j < a[i].length; ++j) {
				a[i][j] = nextInt();
			}
		}
		BitSet[] sets = new BitSet[201];
		for (int i = 1; i <= 200; ++i) {
			sets[i] = new BitSet(m);
		}
		for (int i = 0; i < m; ++i) {
			for (int j : a[i]) {
				sets[j].set(i);
			}
		}
		HashMap<BitSet, Integer> map = new HashMap<BitSet, Integer>();
		ArrayList<Integer>[] ans = new ArrayList[n];
		for (int i = 0; i < n; ++i) {
			ans[i] = new ArrayList<Integer>();
		}
		for (int i = 1; i <= 200; ++i) {
			if (sets[i].isEmpty()) {
				continue;
			}
			if (!map.containsKey(sets[i])) {
				map.put(sets[i], map.size());
			}
			ans[map.get(sets[i])].add(i);
		}
		for (int i = 0; i < n; ++i) {
			out.print(ans[i].size() + " ");
			for (int j : ans[i]) {
				out.print(j + " ");
			}
			out.println();
		}
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			eat("");

			solve();

			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			failed = true;
		}
	}

	void eat(String s) {
		st = new StringTokenizer(s);
	}

	String next() throws IOException {
		while (!st.hasMoreTokens()) {
			String line = in.readLine();
			if (line == null) {
				return null;
			}
			eat(line);
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	static boolean failed = false;

	public static void main(String[] args) {
		Locale.setDefault(Locale.US);
		Thread th = new Thread(new Solution());
		th.start();
		try {
			th.join();
		} catch (InterruptedException iex) {
		}
		if (failed) {
			throw new RuntimeException();
		}
	}

}


import java.io.*;
import java.util.*;

public class Solution implements Runnable {

	private StringTokenizer st;
	private BufferedReader in;
	private PrintWriter out;

	public void solve() throws IOException {
		int n = nextInt();
		int m = n * (n - 1) / 2;
		int[][] a = new int[m][];
		for (int i = 0; i < m; ++i) {
			a[i] = new int[nextInt()];
			for (int j = 0; j < a[i].length; ++j) {
				a[i][j] = nextInt();
			}
		}
		BitSet[] sets = new BitSet[201];
		for (int i = 1; i <= 200; ++i) {
			sets[i] = new BitSet(m);
		}
		for (int i = 0; i < m; ++i) {
			for (int j : a[i]) {
				sets[j].set(i);
			}
		}
		HashMap<BitSet, Integer> map = new HashMap<BitSet, Integer>();
		ArrayList<Integer>[] ans = new ArrayList[n];
		for (int i = 0; i < n; ++i) {
			ans[i] = new ArrayList<Integer>();
		}
		for (int i = 1; i <= 200; ++i) {
			if (sets[i].isEmpty()) {
				continue;
			}
			if (!map.containsKey(sets[i])) {
				map.put(sets[i], map.size());
			}
			ans[map.get(sets[i])].add(i);
		}
		if (n == 2) {
			ans[1].add(ans[0].remove(ans[0].size() - 1));
		}
		for (int i = 0; i < n; ++i) {
			out.print(ans[i].size() + " ");
			for (int j : ans[i]) {
				out.print(j + " ");
			}
			out.println();
		}
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			eat("");

			solve();

			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			failed = true;
		}
	}

	void eat(String s) {
		st = new StringTokenizer(s);
	}

	String next() throws IOException {
		while (!st.hasMoreTokens()) {
			String line = in.readLine();
			if (line == null) {
				return null;
			}
			eat(line);
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

	static boolean failed = false;

	public static void main(String[] args) {
		Locale.setDefault(Locale.US);
		Thread th = new Thread(new Solution());
		th.start();
		try {
			th.join();
		} catch (InterruptedException iex) {
		}
		if (failed) {
			throw new RuntimeException();
		}
	}

}