Problem: Little Vasya likes very much to play with sets consisting of positive integers. To make the game more interesting, Vasya chose n non-empty sets in such a way, that no two of them have common elements.

One day he wanted to show his friends just how interesting playing with numbers is. For that he wrote out all possible unions of two different sets on n·(n - 1) / 2 pieces of paper. Then he shuffled the pieces of paper. He had written out the numbers in the unions in an arbitrary order.

For example, if n = 4, and the actual sets have the following form {1, 3}, {5}, {2, 4}, {7}, then the number of set pairs equals to six. The six pieces of paper can contain the following numbers: 

  * 2, 7, 4. 
  * 1, 7, 3; 
  * 5, 4, 2; 
  * 1, 3, 5; 
  * 3, 1, 2, 4; 
  * 5, 7. 



Then Vasya showed the pieces of paper to his friends, but kept the n sets secret from them. His friends managed to calculate which sets Vasya had thought of in the first place. And how about you, can you restore the sets by the given pieces of paper?

Input

The first input file line contains a number n (2 ≤ n ≤ 200), n is the number of sets at Vasya's disposal. Then follow sets of numbers from the pieces of paper written on n·(n - 1) / 2 lines. Each set starts with the number ki (2 ≤ ki ≤ 200), which is the number of numbers written of the i-th piece of paper, and then follow ki numbers aij (1 ≤ aij ≤ 200). All the numbers on the lines are separated by exactly one space. It is guaranteed that the input data is constructed according to the above given rules from n non-intersecting sets.

Output

Print on n lines Vasya's sets' description. The first number on the line shows how many numbers the current set has. Then the set should be recorded by listing its elements. Separate the numbers by spaces. Each number and each set should be printed exactly once. Print the sets and the numbers in the sets in any order. If there are several answers to that problem, print any of them.

It is guaranteed that there is a solution.

Examples

Input

4
3 2 7 4
3 1 7 3
3 5 4 2
3 1 3 5
4 3 1 2 4
2 5 7


Output

1 7 
2 2 4 
2 1 3 
1 5 


Input

4
5 6 7 8 9 100
4 7 8 9 1
4 7 8 9 2
3 1 6 100
3 2 6 100
2 1 2


Output

3 7 8 9 
2 6 100 
1 1 
1 2 


Input

3
2 1 2
2 1 3
2 2 3


Output

1 1 
1 2 
1 3 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
namespace QoE_Library {
namespace QL_Bare_Minimum {
const double PI = 3.141592653589793238460;
const long double pi = 10000 * acos(-1.0L);
const long double E = 2.7182818284590452353;
const long double eps = 1e-10;
const int DX4[] = {0, 1, 0, -1};
const int DY4[] = {1, 0, -1, 0};
const int DX8[] = {-1, -1, -1, 0, 0, 1, 1, 1};
const int DY8[] = {-1, 0, 1, -1, 1, -1, 0, 1};
const int neigh4[][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
const int neigh8[][2] = {{-1, 0}, {-1, -1}, {0, -1}, {1, -1},
                         {1, 0},  {1, 1},   {0, 1},  {-1, 1}};
const int neigh9[][2] = {{-1, 0}, {-1, -1}, {0, -1}, {1, -1}, {1, 0},
                         {1, 1},  {0, 1},   {-1, 1}, {0, 0}};
template <typename T1>
class Vector3D {
 public:
  T1 x, y, z;
  Vector3D(T1 x1, T1 y1, T1 z1) : x(x1), y(y1), z(z1) {}
  Vector3D() {}
};
template <typename T1>
inline T1 to_type(string s) {
  T1 a;
  istringstream sin(s);
  sin >> a;
  return a;
}
template <typename T1>
inline string to_str(T1 a) {
  ostringstream sout;
  string s;
  sout >> a;
  return sout.str();
}
inline void inpS(char *a) { scanf("%s", a); }
inline int inpI() {
  int n = 0;
  int ch = getchar();
  int sign = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') sign = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    n = (n << 3) + (n << 1) + ch - '0', ch = getchar();
  n = n * sign;
  return n;
}
inline void inpI2(int &a, int &b) {
  a = inpI();
  b = inpI();
}
inline void inpI3(int &a, int &b, int &c) {
  a = inpI();
  b = inpI();
  c = inpI();
}
inline double inpD() {
  double res = 0.0;
  char c;
  while (1) {
    c = getchar();
    if (c == ' ' || c == '\n')
      continue;
    else
      break;
  }
  res = c - '0';
  while (1) {
    c = getchar();
    if (c >= '0' && c <= '9')
      res = 10 * res + c - '0';
    else
      break;
  }
  if (c == '.') {
    double decimal = 0.0, divi = 1.0;
    while (1) {
      c = getchar();
      if (c >= '0' && c <= '9')
        decimal += (c - '0') / (divi *= 10.0);
      else
        break;
    }
    res += decimal;
  }
  return res;
}
inline void outpD(double N) {
  char buff[24], sz = 0;
  int integer = N;
  int decimal = (N - integer) * 10000000;
  int tmp = decimal;
  while (decimal) {
    buff[sz++] = '0' + decimal % 10;
    decimal /= 10;
  }
  for (int decimal2 = 1000000; decimal2 > tmp; decimal2 /= 10) {
    buff[sz++] = '0';
  }
  buff[sz++] = '.';
  if (integer == 0) buff[sz++] = '0';
  while (integer) {
    buff[sz++] = '0' + integer % 10;
    integer /= 10;
  }
  while (--sz >= 0) putchar(buff[sz]);
  putchar(10);
}
inline void outpI(int a) {
  char c;
  char snum[20];
  int i = 0;
  int sign = 0;
  if (a < 0) sign = 1;
  a = abs(a);
  do {
    snum[i++] = a % 10 + 48;
    a = a / 10;
  } while (a != 0);
  i = i - 1;
  if (sign) putchar('-');
  while (i >= 0) putchar(snum[i--]);
  putchar('\n');
}
inline void outpI2(int a, int b) {
  printf("%d ", a);
  outpI(b);
}
inline int outpS(char *s) { return printf("%s\n", s); }
template <typename T1>
void QL_swap(T1 &x, T1 &y) {
  T1 tmp;
  tmp = x;
  x = y;
  y = tmp;
}
template <typename T1>
T1 gcd(T1 a, T1 b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long int euclideanDistSq(long long int x1, long long int y1,
                              long long int x2, long long int y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
template <typename T1>
T1 dotProd(T1 x1, T1 y1, T1 z1, T1 x2, T1 y2, T1 z2) {
  return x1 * x2 + y1 * y2 + z1 * z2;
}
template <typename T1>
Vector3D<T1> crossProd(Vector3D<T1> v1, Vector3D<T1> v2) {
  Vector3D<T1> v;
  v.x = v1.y * v2.z - v2.y * v1.z;
  v.y = v1.z * v2.x - v2.z * v1.x;
  v.z = v1.x * v2.y - v2.x * v1.y;
  return v;
}
}  // namespace QL_Bare_Minimum
}  // namespace QoE_Library
using namespace QoE_Library::QL_Bare_Minimum;
int main() {
  int n;
  cin >> n;
  int t = n * (n - 1) / 2;
  vector<vector<int> > v, s;
  int a[205] = {0};
  int elem[205][205] = {0};
  for (int i = (0); i < (t); i = i + (1)) {
    int b, w;
    cin >> b;
    vector<int> p;
    for (int j = (0); j < (b); j = j + (1)) {
      cin >> w;
      p.push_back(w);
      ;
      a[w] = 1;
      ++elem[w][0];
      elem[w][elem[w][0]] = i;
    }
    sort((p).begin(), (p).end());
    v.push_back(p);
    ;
  }
  if (n > 2) {
    for (int i = (0); i < (201); i = i + (1)) {
      vector<int>::iterator it;
      if (!a[i]) continue;
      vector<int> tmp(v[elem[i][1]]);
      for (int j = (2); j < (elem[i][0] + 1); j = j + (1)) {
        it = set_intersection((tmp).begin(), (tmp).end(),
                              (v[elem[i][j]]).begin(), (v[elem[i][j]]).end(),
                              tmp.begin());
        tmp.resize(it - tmp.begin());
      }
      int k = 0;
      cout << tmp.size();
      for (int j = (0); j < (tmp.size()); j = j + (1)) {
        cout << " " << tmp[j];
        a[tmp[j]] = 0;
      }
      cout << endl;
    }
  } else {
    cout << 1 << " " << v[0][0] << endl;
    cout << v[0].size() - 1;
    for (int i = (0); i < (v[0].size() - 1); i = i + (1)) {
      cout << " " << v[0][i + 1];
    }
  }
}