eolymp
bolt
Try our new interface for solving problems
Problems

Find a set of patterns 1

Find a set of patterns 1

For each string from the given set \textbf{S} check, is it true that it contains as a substring at least one string from the set \textbf{T}. \InputFile The first line contains the number of strings \textbf{n} (\textbf{n} ≤ \textbf{100}) in the set \textbf{T}. Each of the next \textbf{n} lines contains the nonempty string of no more than \textbf{80} characters. The last part of the input contains the strings from the set \textbf{S}. Each line consists of ASCII characters with codes from \textbf{32 to} \textbf{126} inclusive. The string can be empty; it is guaranteed that the string length does not exceed \textbf{250} characters. The total input does not exceed \textbf{1} МByte. \OutputFile Print all the strings from set \textbf{S} (in the same order as they are in input), that contains as a substring at least one string from the set \textbf{T}.
Time limit 1 second
Memory limit 64 MiB
Input example #1
3
gr
sud
abc
lksh
sudislavl
kostroma
summer
group b
Output example #1
sudislavl
group b