Spelling Bee

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

The New York Times publishes a daily puzzle called the "Spelling Bee." In this puzzle, 77 letters are shown in a hexagonal arrangement of 66 letters around a center letter.  The task is to come up with as many words as possible that 

  • contain only letters that are displayed in the hexagon,
  • are at least of length 44, and
  • contain the center letter.

A letter may be used more than once, and not all letters need to be used.

After playing for a while, you get stuck, but then you remind yourself that the Linux distribution on your computer comes with a machine-readable file of 102,305102\\,305 dictionary words in /usr/share/dict/words!

You decide that even if you can't excel at the Spelling Bee you can still excel at programming, so you decide to write a program that finds all solutions to a Spelling Bee puzzle from your dictionary.

입력

The input consists of a single test case, which starts with a line with 77 distinct lowercase English letters. The first of these letters is the center letter.  The next line contains an integer nn (1n102,3051 \le n \le 102\\,305), the size of the dictionary. This line is followed by nn lines, each containing a dictionary word of ll lowercase English letters (1l241 \le l \le 24).

출력

Output the word list matching the Spelling Bee puzzle in the order in which they appear in the dictionary.  You are guaranteed that at least one dictionary entry will match.