Problem: Vasya has several phone books, in which he recorded the telephone numbers of his friends. Each of his friends can have one or several phone numbers.

Vasya decided to organize information about the phone numbers of friends. You will be given n strings — all entries from Vasya's phone books. Each entry starts with a friend's name. Then follows the number of phone numbers in the current entry, and then the phone numbers themselves. It is possible that several identical phones are recorded in the same record.

Vasya also believes that if the phone number a is a suffix of the phone number b (that is, the number b ends up with a), and both numbers are written by Vasya as the phone numbers of the same person, then a is recorded without the city code and it should not be taken into account.

The task is to print organized information about the phone numbers of Vasya's friends. It is possible that two different people have the same number. If one person has two numbers x and y, and x is a suffix of y (that is, y ends in x), then you shouldn't print number x. If the number of a friend in the Vasya's phone books is recorded several times in the same format, it is necessary to take it into account exactly once.

Read the examples to understand statement and format of the output better.

Input

First line contains the integer n (1 ≤ n ≤ 20) — number of entries in Vasya's phone books. 

The following n lines are followed by descriptions of the records in the format described in statement. Names of Vasya's friends are non-empty strings whose length does not exceed 10. They consists only of lowercase English letters. Number of phone numbers in one entry is not less than 1 is not more than 10. The telephone numbers consist of digits only. If you represent a phone number as a string, then its length will be in range from 1 to 10. Phone numbers can contain leading zeros.

Output

Print out the ordered information about the phone numbers of Vasya's friends. First output m — number of friends that are found in Vasya's phone books.

The following m lines must contain entries in the following format "name number_of_phone_numbers phone_numbers". Phone numbers should be separated by a space. Each record must contain all the phone numbers of current friend.

Entries can be displayed in arbitrary order, phone numbers for one record can also be printed in arbitrary order.

Examples

Input

2
ivan 1 00123
masha 1 00123


Output

2
masha 1 00123 
ivan 1 00123 


Input

3
karl 2 612 12
petr 1 12
katya 1 612


Output

3
katya 1 612 
petr 1 12 
karl 1 612 


Input

4
ivan 3 123 123 456
ivan 2 456 456
ivan 8 789 3 23 6 56 9 89 2
dasha 2 23 789


Output

2
dasha 2 23 789 
ivan 4 789 123 2 456 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
double pi = 2 * acos(0.0);
long long _sieve_size;
bitset<10000010> _bs;
vector<long long> _primes;
void sieve(long long upperbound) {
  _sieve_size = upperbound;
  _bs.set();
  _bs[0] = _bs[1] = 0;
  for (long long i = 2; i <= _sieve_size; i++)
    if (_bs[i]) {
      for (long long j = i * i; j <= _sieve_size; j += i) _bs[j] = 0;
      _primes.push_back(i);
    }
}
bool isPrime(long long N) {
  if (N <= _sieve_size) return _bs[N];
  for (int i = 0; i < _primes.size(); i++)
    if (N % _primes[i] == 0) return false;
  return true;
}
vector<long long> primeFactors(long long N) {
  vector<long long> factors;
  long long PF_idx = 0, PF = _primes[PF_idx];
  while (PF * PF <= N) {
    while (N % PF == 0) {
      N /= PF;
      factors.push_back(PF);
    }
    PF = _primes[++PF_idx];
  }
  if (N != 1) factors.push_back(N);
  return factors;
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
long long FastPower(long long Num, long long Pow) {
  if (Pow == 0) return 1;
  if (Pow == 1) return Num;
  long long Result = FastPower(Num, Pow / 2);
  Result *= Result;
  if (Pow % 2 != 0) Result *= Num;
  return Result;
}
long long power(long long x, unsigned long long y, long long mod) {
  long long temp;
  if (y == 0) return 1;
  temp = power(x, y / 2, mod) % mod;
  if (y % 2 == 0)
    return (temp % mod * temp % mod) % mod;
  else
    return ((x % mod * temp) % mod * temp) % mod;
}
long long ncr(long long n, long long r) {
  r = min(r, n - r);
  long long ans = 1;
  for (int i = 1; i <= r; i++) {
    ans *= n - i + 1;
    ans /= i;
  }
  return ans;
}
bool isPowerOfTwo(int x) { return (x && !(x & (x - 1))); }
bool sortbysec(const string &a, const string &b) {
  return (a.size() < b.size());
}
double binet(unsigned int n) {
  static const double phi = (1 + sqrt(5)) * 0.5;
  double fib = (pow(phi, n) - pow(1 - phi, n)) / sqrt(5);
  return round(fib);
}
long largest_power_of_two(long N) {
  N = N | (N >> 1);
  N = N | (N >> 2);
  N = N | (N >> 4);
  N = N | (N >> 8);
  return (N + 1) >> 1;
}
int solve(string temp, string mobile) {
  long long cnt = 0;
  bool Flag = 0;
  if (temp.size() > mobile.size()) {
    for (int i = temp.size() - mobile.size(); i < temp.size(); i++) {
      if (temp[i] != mobile[cnt]) {
        Flag = 1;
        break;
      }
      cnt++;
    }
    if (Flag) return 0;
    return 1;
  } else {
    for (int i = mobile.size() - temp.size(); i < mobile.size(); i++) {
      if (temp[cnt] != mobile[i]) {
        Flag = 1;
        break;
      }
      cnt++;
    }
    if (Flag) return 0;
    return -1;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  map<string, set<string> > mp;
  while (n--) {
    string s;
    long long y;
    cin >> s >> y;
    while (y--) {
      string mobile;
      cin >> mobile;
      if (!mp[s].size()) {
        mp[s].insert(mobile);
        continue;
      }
      bool Flag = 0;
      vector<string> v;
      for (set<string>::iterator it = mp[s].begin(); it != mp[s].end(); it++) {
        string temp = *it;
        int x = solve(temp, mobile);
        if (temp == mobile || x == 1) {
          Flag = 1;
          break;
        } else if (x == -1)
          v.push_back(temp);
      }
      if (!Flag) mp[s].insert(mobile);
      for (int i = 0; i < v.size(); i++) mp[s].erase(v[i]);
    }
  }
  cout << mp.size() << '\n';
  for (map<string, set<string> >::iterator it = mp.begin(); it != mp.end();
       it++) {
    cout << it->first << ' ' << (it->second).size() << ' ';
    set<string> s = it->second;
    for (set<string>::iterator on = s.begin(); on != s.end(); on++)
      cout << *on << ' ';
    cout << '\n';
  }
  return 0;
}