On the Subject of Keypads Keep Talking and Nobody Explodes is a local multiplayer game where one player has control over a virtual "bomb", and has to be guided by another player, the "expert", who has access to a bomb defusal manual. One of the modules to be disarmed in the game is the keypad module, which is what we'll be dealing with in this challenge.

The task

Input will start with a single line of printable ASCII characters except space (0x21 to 0x7E). These represent the keypad buttons visible to you.

The next few lines will represent "keys" – only one line will contain all of the characters of the first line, not necessarily in order. Your task is to output the keypad characters, in the order of the matching key line.

For example, if the input was

5~Fy
HrD7K!#}
Ui%^fHnF
)Tf;y~I5
~Fi(&amp;5gy
,'Xd#5fZ


then the keypad buttons are 5, ~, F and y. Only the 4th key line ~Fi(&amp;5gy contains all of these characters, so we output the keypad characters in the order in which they appear, i.e. ~F5y.

Rules and clarifications


Input must be a single multiline string, with the keypad buttons and key lines on separate lines.
There will be exactly one key line which contains all of the keypad characters.
Every line, i.e. the initial keypad line and following key lines, will have no duplicate characters.
Unlike the game, you may not assume anything about the number of keypad characters, the length of each key line or the number of key lines. However, all key lines are guaranteed to be the same length.
The output may contain a single optional trailing newline. Similarly you may assume either way about an optional trailing newline in the input, but please specify in your answer if you need the assumption.
Although this already seems to be common practice, I'll state explicitly: terminating with an error is okay for this challenge, as long as STDOUT output is correct (if this is your chosen form of output). Hopefully this will make handling input easier.


Test cases

7
4?j01C3"ch
KP.OG&gt;QB)[
z#)Kn"I2&amp;.
]#,D|sBFy5
Qzj*+~7DLP


Output: 7. Only the last line contains a 7.

0b~
Ob+hy{M|?;&gt;=dtszPAR5
*8rCfsw|3O9.7Yv^x&gt;Hq
$ip.V@n}|La:TbIt^AOF
jZ[Ec4s0|%b*$id',~J6
z*#b}-x$Ua&amp;!O2;['T+?
NVj_X8rlhxfnS\.z}];c
bykscf.w^dnWj+}-*2g_
VP`AJH|&amp;j5Yqmw/"9IMc


Output: 0b~. The 4th key line already contains the characters in the right order.

MTuz
bIAr&gt;1ZUK`s9c[tyO]~W
oMGIi/H&amp;V"BeNLua%El=
j*uYbplT:~);BM|_mPZt
Q}z5TC@=6pgr&lt;[&amp;uJnM%
YOA(F~_nH6T{%B7[\u#5
y&amp;t"8zQn{wo5[Idu4g:?
[0tZG"-fm!]/|nqk,_2h
dA&amp;C.+(byo6{7,?I}D@w


Output: zTuM. The key line is the 4th one, although the 3rd key line is a close miss.

o@nj&lt;G1
f]?-&lt;I6h2vS*%l=:}c8&gt;LK5rMdyeon,;sE[@m(73
ibhp+2Hq6yKzIf_Zo}EO3-[*0/e&amp;Fvd]wQU=|%`C
;}&gt;d'cg~CPtQG&amp;%L\)MUl419bkTZ7@]:[*H"RyYj
L^&lt;:zXJ#kj$EFlwN%B`Dd,Cs?]xRZ*K9-uQ.@&amp;f+
i1v'7:90R-l}FMxj`,DTWK+(n32Z4Vs[p@%*eS!d
B|^Ti/ZG$}ufL9*wE[AVt]P7CrX-)2JpD&lt;sYxd6O
ex.$4#KarS^j+'_!B"]H[\83:(DCXUgI*Lct?qAR
^GXQoy*KW&amp;v}n']Em~\N9)fxP(qC=7#4sRdcD6%5
;inr[&amp;$1j_!F~@pzo#blv]}&lt;'|fRds6OW%tEg"G2
e;0T#gfo^+!:xHDN&amp;4V=In?AwhEv$2Fd~ZLz_\81


Output: n1j@o&lt;G. The key line is the second last line.

Scoring

This is code-golf, so the code in the fewest bytes wins.
CJam, 13 12 bytes

qN/(f&amp;{,}$W=


Test it here.

Explanation

q     e# Read all input.
N/    e# Split into lines.
(     e# Pull off the keypad buttons.
f&amp;    e# Take the set intersection of each key line with the keypad, preserving the order
      e# order in the key line.
{,}$  e# Sort the results by length.
W=    e# Pick the last (longest) one.