QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#13065. A String Game

Statistics

Recently Alice and Bob are playing a game about strings. Before starting the game, they should prepare $n$ strings $s_1$, $s_2$, ..., $s_n$ and a target string $t$. It's promised that each of these $n$ strings is a substring of $t$.

When the game begins, they do the following things alternately while Alice starts first:

  • Choose a string $s_i$ from the $n$ strings;
  • Append one letter to the chosen string;
  • The new string must also be a substring of $t$.

If the above things cannot be completed, the player loses the game. Suppose Alice and Bob both use optimal strategy, find who will win the game.

Input

The input consists of multiple test cases.

Each test case begins with the non-empty target string $t$, whose length will not exceed $100000$. The second line contains an integer $n$ $(1 \leq n \leq 100)$, the number of strings they prepared. Then $n$ lines follow. The $i$-th line of the following $n$ lines is the string $s_i$. The input guarantees that each of the $n$ strings must be a non-empty substring of $t$.

The total length of all strings will not exceed $30\,000\,000$.

Output

For each test case, output the winner "Alice" or "Bob" (without quotes) in one line.

Example

Input

aaaa
1
a
abcabd
1
a

Output

Alice
Bob

Discussions

About Discussions

The discussion section is only for posting: Editorials, 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. Submitting multiple issues may cause your account to be banned.
  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.