F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Flipping coins

Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 164    Accepted Submission(s): 14


Problem 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
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-26 11:03:48, Gzip enabled