#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int l = n * (n - 1) / 2;
  vector<long long int> a[l];
  for (int i = 0; i < l; i++) {
    int k;
    cin >> k;
    for (int j = 0; j < k; j++) {
      int x;
      cin >> x;
      a[i].push_back(x);
    }
  }
  if (n == 2) {
    int len = a[0].size();
    cout << 1 << " " << a[0][len - 1] << endl << len - 1 << " ";
    for (int i = 0; i < len - 1; i++) cout << a[0][i] << " ";
    cout << endl;
    return 0;
  }
  unordered_map<int, vector<long long int> > M1;
  for (int i = 0; i < l; i++) {
    for (int j = 0; j < a[i].size(); j++) {
      M1[a[i][j]].push_back(i);
    }
  }
  map<vector<long long int>, vector<long long int> > M2;
  for (auto it = M1.begin(); it != M1.end(); it++) {
    int x = it->first;
    vector<long long int> v = it->second;
    M2[v].push_back(x);
  }
  for (auto it = M2.begin(); it != M2.end(); it++) {
    cout << it->second.size() << " ";
    for (int i = 0; i < it->second.size(); i++) {
      cout << it->second[i] << " ";
    }
    cout << endl;
  }
}
