AT_past202303_i 簡易オマハポーカー

Description

$ N $ players numbered $ 1, \dots, N $ sitting around a table play a card game. There are $ 26 $ kinds of cards, each of which has `A`, `B`, …, or `Z` written on it. Five cards are placed on the table, and four are dealt to each player. The cards on the table are represented by a string $ X $ of length five, and the cards dealt to player $ i \, (1 \leq i \leq N) $ are represented by a string $ S_i $ of length four. $ X, S_1, \dots $ , and $ S_N $ consist of uppercase English letters, representing the kinds of the cards. Each player chooses two cards from those dealt to the player and three from those on the table to make a set of five cards. This set is called the player's **hand**. For each $ i \, (1 \leq i \leq N) $ , define $ n_i $ and $ c_i $ as follows: - let $ n_i = n $ and $ c_i = c $ , where $ n $ is the maximum integer such that player $ i $ 's hand contains $ n $ cards of the same kind, and $ c $ is the character written on them. If there are multiple candidates, choose the alphabetically smallest $ c $ . The superiority between two players $ A $ and $ B $ $ (A \neq B) $ is determined as follows: - $ A $ is superior if $ n_A > n_B $ , and $ B $ is superior if $ n_B > n_A $ . - If $ n_A = n_B $ , it is determined as follows: - If $ c_A \neq c_B $ , $ A $ is superior if $ c_A $ is alphabetically smaller than $ c_B $ , and $ B $ is superior if it is larger. - If $ c_A = c_B $ , $ A $ is superior if $ A < B $ , and $ B $ is superior if $ B > A $ . Find the supreme player if all players play optimally. In other words, find $ i $ such that: - for all $ j \neq i $ , player $ i $ is superior to player $ j $ .

Input Format

The input is given from Standard Input in the following format: > $ N $ $ X $ $ S_1 $ $ \vdots $ $ S_N $

Output Format

Print the answer.

Explanation/Hint

### Sample Explanation 1 Here, a hand is represented by a string consisting of the five uppercase English letters written on the cards. For example, suppose that player $ 1 $ chooses the cards with `D` and `B` from the dealt ones and those with `A`, `B`, and `C` from those on the table; then the hand is represented by, for instance, `DBABC` or `ABBCD` (both represent the same hand). The following are examples of (not necessarily optimal) plays. - If player $ 1 $ makes a hand `BCDDD` and player $ 2 $ makes `AABBQ`, we have $ n_1 = 3 $ , $ c_1 = $ `D`, $ n_2 = 2 $ , and $ c_2 = $ `A`. In this case, player $ 1 $ is superior. - If player $ 1 $ makes a hand `BCDDD` and player $ 2 $ makes `AAABB`, we have $ n_1 = 3 $ , $ c_1 = $ `D`, $ n_2 = 3 $ , and $ c_2 = $ `A`. In this case, player $ 2 $ is superior. - If player $ 2 $ makes a hand `AAABB` and player $ 3 $ makes `AAABZ`, we have $ n_2 = 3 $ , $ c_2 = $ `A`, $ n_3 = 3 $ , and $ c_3 = $ `A`. In this case, player $ 2 $ is superior. One possible optimal hand of each player is as follows: player $ 1 $ makes `ABDDD`, player $ 2 $ makes `AAABB`, and player $ 3 $ makes `AAABZ`. Since player $ 2 $ is superior to both players $ 1 $ and $ 3 $ , the answer is $ 2 $ . ### Constraints - $ 2 \leq N \leq 1000 $ - $ N $ is an integer. - $ X $ is a string of length $ 5 $ consisting of uppercase English letters. - $ S_i \, (1 \leq i \leq N) $ is a string of length $ 4 $ consisting of uppercase English letters.