Flipping coins

Time Limit: 2000ms
Memory Limit: 65536KB
This problem will be judged on HDU. Original ID: 5169
64-bit integer IO format: %I64d      Java class name: Main

Description

Alice and Bob are playing a game , everyone has a string made of 0/1, Alice's one called A , and Bob's one called B.
There is an uniform coin and an empty string $S$. When the game start, every round they toss the coin , if the coin face up, add a '0' to the bottom of $S$, otherwise add a '1'.
At the end of every round, they check if A or B becomes a substring of $S$, if A is the substring of $S$ , Alice wins, and if B is the substring of $S$ , Bob wins. In order to avoid the two person win at the same time. A will not be a suffix of B, and B will not be a suffix of A either.
Now we get A and B , we want to know whether the game is fair. if it's unfair , who will more going to be winner?

Input

There is a number T shows there are T test cases below. ($T \leq 50$)
For each test case contains a line , including the string A and B.
$1 \leq |A|,|B| \leq 100$

Output

For each case output, if the game is fair , output "Fair" , otherwise output "A" or "B" who has more chance to win.

Sample Input

2
0 1
011 110

Sample Output

Fair
A

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .