QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 512 MB 總分: 100

#4315. A Simple Card Game

统计

Alice and Bob have been playing many complex games lately, so they want to play something simple to relax.

They recalled a very simple game called "Bie Qi," which only requires a deck of cards. The traditional rules of "Bie Qi" are slightly complicated, so Alice and Bob decided to play a simplified version.

The deck used in the game consists of four suits: Spades, Hearts, Clubs, and Diamonds. Each suit has 13 cards with values from 1 to 13, for a total of 52 cards.

The rules of the simplified game are as follows:

  1. First, the 52-card deck is divided equally into two piles of 26 cards each, one for Alice and one for Bob.
  2. The player who holds the 7 of Spades places it on the table.
  3. Then, starting with the other player, they take turns. In each turn, a player must choose one card from their hand to place on the table. A card can be played if it satisfies one of the following two conditions:
    • The card's value is 7.
    • There is already a card on the table of the same suit whose value differs by exactly 1.
  4. If the current player cannot play a card according to the rules, that player loses, and the other player wins. If both players play all their cards, the game is a draw.

Since the sequences for different suits are independent, players often arrange the 7s of different suits in a column and extend the sequences on both sides of the 7s, arranging cards of the same suit in a row.

Assume both Alice and Bob play optimally. Given Alice's initial hand, calculate the result of the game.

Input

Since one player's hand can be deduced from the other's, the input only contains all of Alice's cards.

The input consists of a single line containing 26 space-separated strings, each representing a card in Alice's hand.

Each card is represented by a suit character followed by its value. The suit is represented by one character: S for Spades, H for Hearts, C for Clubs, and D for Diamonds. The value is represented by a one or two-digit number from 1 to 13, with no leading zeros. For example, the 7 of Spades is represented as S7.

Output

Output a single line containing a string representing the result of the game. If Alice wins, output Alice; if Bob wins, output Bob; if it is a draw, output Draw.

Examples

Input 1

S4 S6 S11 S13 H3 H4 H5 H6 H8 H10 H12 C2 C4 C5 C6 C8 C9 C11 C13 D1 D4 D5 D6 D8 D10 D12

Output 1

Bob

Input 2

S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13

Output 2

Draw

Input 3

H1 H2 H3 H4 H5 H6 H7 H8 H9 H10 H11 H12 C13 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13

Output 3

Alice

Subtasks

For $100\%$ of the data, it is guaranteed that the input cards follow the specified format and that the 26 cards provided are distinct.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.