Олимпиадный тренинг

Задача 27022. Complex passwords


Задача

Темы:
As you know, accounts are often hacked on the Internet. So Arkady again received a notification that they tried to hack it. He wants to come up with a complex password, but one that is easy to remember. He easily remembers a password if it consists of his favorite words and combinations of numbers, and finds it quite difficult if all his favorite words alternate with his favorite sets of numbers. He has a list of such words and sets of numbers, help him find the maximum number of such combinations of such. 
 
Input:
in the first line enter n - the number of words and sets of numbers, in the next n lines enter words / sets of numbers. (n<20, no more than 20 lines). 
Output:
It is necessary to display all possible permutations of words and sets of numbers, if this is not possible, output "unreal".

Enter Output
3
cat
123
215
123cat215
215cat123


(с) Veronica Peutina