AT_abc441_b [ABC441B] Two Languages

Description

The AtCoder country has two official languages: Takahashi-go and Aoki-go. Both Takahashi-go and Aoki-go use some lowercase English letters to write words in those languages. Takahashi-go uses only the characters contained in a string $ S $ of length $ N $ , and Aoki-go uses only the characters contained in a string $ T $ of length $ M $ . You are given $ Q $ words $ w _ 1,w _ 2,\ldots,w _ Q $ that are in the official languages of the AtCoder country. For each word, determine which of the following applies based on the characters contained in that word: - It is confirmed to be a word in Takahashi-go - It is confirmed to be a word in Aoki-go - Neither can be determined

Input Format

The input is given from Standard Input in the following format: > $ N $ $ M $ $ S $ $ T $ $ Q $ $ w _ 1 $ $ w _ 2 $ $ \vdots $ $ w _ Q $

Output Format

Print $ Q $ lines. The $ i $ -th line should contain `Takahashi` if it is confirmed that $ w _ i $ is a word in Takahashi-go, `Aoki` if it is confirmed to be a word in Aoki-go, and `Unknown` if neither can be determined.

Explanation/Hint

### Sample Explanation 1 For example, all of `a`, `s`, `h`, `i` are used in Takahashi-go, and `h` is not used in Aoki-go, so it is confirmed that `asahi` is a word in Takahashi-go. Thus, print `Takahashi` on the first line. Both `i` and `t` are used in both Takahashi-go and Aoki-go, so it cannot be determined whether `it` is a word in Takahashi-go or Aoki-go. Thus, print `Unknown` on the fifth line. ### Sample Explanation 2 `o` is not used in Takahashi-go, so the first two words are confirmed to be words in Aoki-go. Thus, print `Aoki` on the first and second lines. `t` and `n` are not used in Aoki-go, so the following two words are confirmed to be words in Takahashi-go. Thus, print `Takahashi` on the third and fourth lines. For the first four words, there is a rule that words ending in `shi` are Takahashi-go, and words ending in `ki` are Aoki-go. However, all of `k`, `a`, `s`, `h`, `i` are used in both Takahashi-go and Aoki-go, so it is impossible to determine which language the word `kashi` belongs to based on the characters used. Thus, print `Unknown` on the fifth line. ### Constraints - $ 1\le N\le26 $ - $ 1\le M\le26 $ - $ S $ is a string of length $ N $ consisting of lowercase English letters. - The characters in $ S $ are arranged in alphabetical order. - All characters in $ S $ are distinct. - $ T $ is a string of length $ M $ consisting of lowercase English letters. - The characters in $ T $ are arranged in alphabetical order. - All characters in $ T $ are distinct. - $ 1\le Q\le100 $ - $ w _ i $ is a string of length at least $ 1 $ and at most $ 100 $ consisting of lowercase English letters. $ (1\le i\le Q) $ - $ w _ i $ is a word in Takahashi-go or Aoki-go. $ (1\le i\le Q) $ - $ N,M,Q $ are integers.