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 JAVA):

Solution:
/* Author: Ronak Agarwal */
import java.io.* ; import java.util.* ; import java.math.* ;
import static java.lang.Math.min ;
import static java.lang.Math.max ;
import static java.lang.Math.abs ;
/* Thread is created here to increase the stack size of the java code so that recursive dfs can be performed */
public class Codeshefcode{
	public static void main(String[] args) throws IOException{
		new Thread(null,new Runnable(){	public void run(){ exec_Code() ;} },"Solver",1l<<27).start() ;
	}
	static void exec_Code(){
		try{
			Solver Machine = new Solver() ;
			Machine.Solve() ; Machine.Finish() ;}
		catch(Exception e){ e.printStackTrace() ; print_and_exit() ;}
		catch(Error e){ e.printStackTrace() ; print_and_exit() ; }
	}
	static void print_and_exit(){ System.out.flush() ; System.exit(-1) ;}
}
class Reader{
	BufferedReader reader;
	StringTokenizer tkz;
	Reader(InputStream input) {
		reader = new BufferedReader(new InputStreamReader(input)) ;
		tkz = new StringTokenizer("") ;
	}
	String s() throws IOException{
		while (!tkz.hasMoreTokens()) tkz = new StringTokenizer(reader.readLine()) ;
		return tkz.nextToken() ;
	}
	int i() throws IOException{ return Integer.parseInt(s()) ;}
	long l() throws IOException{ return Long.parseLong(s()) ;}
	double d() throws IOException{	return Double.parseDouble(s()) ;}
}
/* All the useful functions,constants,renamings are here*/
class Template{
	/* Constants Section */
	final int INT_MIN = Integer.MIN_VALUE ; final int INT_MAX = Integer.MAX_VALUE ;
	final long LONG_MIN = Long.MIN_VALUE ; final long LONG_MAX = Long.MAX_VALUE ;
	static long MOD = 1000000007 ;
	static Reader ip = new Reader(System.in) ;	
	static PrintWriter op = new PrintWriter(System.out) ;
	/* Methods for writing */
	static void p(Object o){ op.print(o) ; }
	static void pln(Object o){ op.println(o) ;}
	static void Finish(){ op.flush();	op.close(); }
	/* Implementation of operations modulo MOD */
	static long inv(long a){ return powM(a,MOD-2) ; }
	static long m(long a,long b){ return (a*b)%MOD ; }
	static long d(long a,long b){ return (a*inv(b))%MOD ; }
	static long powM(long a,long b){
		if(b<0) return powM(inv(a),-b) ;
		long val=a ; long ans=1 ;
		while(b!=0){
			if((b&1)==1) ans = (ans*val)%MOD ; 
			val = (val*val)%MOD ; 
			b/=2 ;
		}
		return ans ;
	}
	/* Renaming of some generic utility classes */
	final static class mylist extends ArrayList<Integer>{}
	final static class myset extends TreeSet<pair>{}
	final static class mystack extends Stack<Integer>{}
	final static class mymap extends TreeMap<String,Trie>{}
}
/* Implementation of the pair class, useful for every other problem */
class pair implements Comparable<pair>{
	long x ; int y ;
	pair(long _x,int _y){ x=_x ; y=_y ;} 
	public int compareTo(pair p){
		return (this.x<p.x ? -1 : (this.x>p.x ? 1 : (this.y<p.y ? -1 : (this.y>p.y ? 1 : 0)))) ;
	}
}
class Trie{
	Trie chd[] ;
	int dep ;
	Trie(int _dep){
		chd = new Trie[10] ;
		dep = _dep ;
	}
}

/* Main code starts here */
class Solver extends Template{
	ArrayList<String> res ;
	void dfs(Trie nd,mylist ls){
		int ct=0 ;
		for(int i=0 ; i<10 ; i++)
			if(nd.chd[i]!=null){
				ls.add(i) ;
				dfs(nd.chd[i],ls) ;
				ls.remove(ls.size()-1) ;
				ct++ ;
			}
		if(ct==0){
			String str = "" ;
			for(int i=ls.size()-1 ; i>=0 ; i--) str+=(""+((char) (ls.get(i)+'0'))) ;
			res.add(str) ;
		}
	}
	public void Solve() throws IOException{
		int n = ip.i() ;
		mymap mp = new mymap() ;
		for(int i=0 ; i<n ; i++){
			String name = ip.s() ;
			if(!mp.containsKey(name)) mp.put(name,new Trie(0)) ;
			Trie tr = mp.get(name) ;
			int ct = ip.i() ;
			for(int itr=0 ; itr<ct ; itr++){
				Trie nd = tr ;
				String number = ip.s() ;
				for(int j=number.length()-1 ; j>=0 ; j--){
					int dig = (number.charAt(j)-'0') ;
					if(nd.chd[dig]==null) nd.chd[dig] = new Trie(nd.dep+1) ;
					nd = nd.chd[dig] ;
				}
			}
		}
		pln(mp.size()) ;
		for(String key : mp.keySet()){
			res = new ArrayList<String>() ;
			Trie tr = mp.get(key) ;
			dfs(tr,new mylist()) ;
			p(key+" ") ;
			p(res.size()+" ") ;
			for(String elem : res) p(elem+" ") ;
			pln("") ;
		}
	}
}