题目描述
Problem Description
A game of Three Kingdoms Kill involves $n$ players, each needing 4 cards. The deck contains $k$ cards and needs to be shuffled before dealing. Each card has the following 3 attributes:
-
Card Type:
- Basic: Kill ($\texttt{K}$), Dodge ($\texttt{M}$), Peach ($\texttt{P}$), Wine ($\texttt{W}$).
- Non-Delayed Trinkets: Duel ($\texttt{B}$), Arrow Volley ($\texttt{A}$), Southern Barbarians ($\texttt{S}$), Grain Harvest ($\texttt{C}$), Peach Garden ($\texttt{G}$), Dismantle ($\texttt{D}$), Snatch ($\texttt{U}$), Iron Chain ($\texttt{T}$), Nullification ($\texttt{N}$), Fire Attack ($\texttt{F}$), Unlimited ($\texttt{E}$).
- Delayed Trinkets: Soldier ($\texttt{I}$), Joy ($\texttt{K}$), Lightning ($\texttt{L}$).
- Horses ($\texttt{+,-}$).
- Weapons: Crossbow ($\texttt{LN}$), Qinggang ($\texttt{QG}$), Guting ($\texttt{GD}$), Ice ($\texttt{HB}$), Dual ($\texttt{CX}$), Wulu ($\texttt{WL}$), Green Dragon ($\texttt{QL}$), Long Spear ($\texttt{ZB}$), Stone Piercer ($\texttt{GS}$), Sky Piercer ($\texttt{FT}$), Feather Fan ($\texttt{YS}$), Qilin ($\texttt{LG}$).
- Armor: Renwang ($\texttt{RW}$), Eight Diagram ($\texttt{BZ}$), Vine ($\texttt{TJ}$), Lion ($\texttt{SZ}$). -
Suit: Can only be one of $\texttt{C, H, S, D}$.
-
Rank: Can only be one of $\texttt{A, 2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K}$ (T represents 10, in ascending order).
Shuffling Method: After one shuffle, the order from top to bottom is: $\left\lfloor\dfrac{k}{2}\right\rfloor+1, 1, \left\lfloor\dfrac{k}{2}\right\rfloor+2, 2, \left\lfloor\dfrac{k}{2}\right\rfloor+3, 3, ..., k, \left\lfloor\dfrac{k}{2}\right\rfloor$ (if there are an odd number of cards, the last card is ignored).
Dealing Method: Starting from the 1st card, the $i$-th card is given to the player numbered $[(i-1) \mod n + 1]$.
Given that the deck is shuffled $m$ times, you are asked to determine the 4 cards received by the $p$-th player.
Input Format
The input consists of $k+1$ lines.
The first line contains 4 positive integers $n, k, m, p$.
The following $k$ lines each contain two strings, where the first string's first character represents the suit and the second character represents the rank, and the second string represents the card type. The output format for the player's cards should be the same as the input.
The meanings of $n, k, m, p$ are as described in the problem.
Output Format
The output consists of 4 lines, each containing a string representing the 4 cards held by the $p$-th player (including the suit, rank, and type of each card, in the same format as the input).
If there are not enough cards, output Error:cards not enough.
Sample Input and Output
Input Sample #1
2 10 1 1
C2 K
H5 B
DT K
SA M
HQ P
D4 K
C6 P
H9 M
ST B
SK C
Output Sample #1
D4 K
C6 P
H9 M
ST B
Input Sample #2
2 7 1 1
C2 K
H5 B
DT K
SA M
HQ P
SK C
C6 P
Output Sample #2
Error:cards not enough
Notes
For $100\%$ of the data, it is guaranteed that $1 \leqslant p \leqslant n \leqslant 1000, 1 \leqslant k \leqslant 100000, 1 \leqslant m \leqslant 80$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分