The Russian troops are closing up on us! The war has officially begun! Hiroshima and Nagasaki seem like child's play compared to the threats of today! The sound of the president's voice jumped of the walls like a couple of Brownian particles. We were losing. Despite our attempt to clear our financial situation and break free from the jaws of the Chinese government...all our efforts were in vain. We had failed our nation. All we can do now is fight back and try to save as many lives as possible. Could this really be the end of the human race? Are we really going to wipe out this entire planet for the sake of global domination...there will be nothing left to dominate! We stare out the window. Thousands of commoners are fleeting...what for? Gamma rays can penetrate human flesh in milliseconds! Footsteps approaching...turn...it's the president. He's changed...pale as a corpse and on the verge of tears...this was once a man who we all believed can move mountains. War infects everything...it's the worst of diseases...
Soldiers, men of honor, you have protected this nation since the earliest meetings of our founding fathers! It is now your duty, as human beings and celebrated citizens of this nation to inform as many officials and citizens alike to flee this area. Do not panic or cave into the depths of despair...we need you more than ever...
Machine guns. Screaming. Gun powder in the air. I felt my lungs fill up with smoke! Quick ...I must tell the other officials about the attack...
As I ran towards the public media room I felt time slow down. I keep hoping that it's all just a nightmare and that I'll wake up...tears. I finally reach the media room and head straight to the main control panel.
All emails have a standard format (string@nationX.com). The control panel looks like a giant phone -- it has 10 keys, each with some corresponding letters. You have to form strings which represent the numbers you press. For example, 013 means that you pressed 0 (a certain number of times), then 1 (a certain number of times), and finally 3 (a certain number of times). I start to hesitate. I have to generate all of the possible strings once in order to email all of the necessary people. And they have to be in lexicographic order... tick tock goes the nuclear clock...
InputThe first 10 lines of input describe the keys. Each line is a list of distinct letters that correspond to a key, without any separators. The 11th line is a list of digits representing the address format.
OutputList all possible usernames in lexicographic order, separated by newlines. Each username should be listed exactly once.
ConstraintsThe letters are lowercase letters of the English alphabet.
The usernames have at most 10 letters.