Biswa and Debu are playing a weird word game. Biswa has a set S of N strings. Debu makes Q turns. In each turn he gives Biswa a string T.
In each turn, Biswa's task is to find the longest substring of T which is also a substring in one of the strings in S.
Note: You can find the definition of substring here.
Input