CodeChef: Codechef
Site under maintenance
  • Register
  • Forgot Password?
  • PRACTICE
    • Easy
    • Medium
    • Hard
  • COMPETE
    • August Mini Challenge
    • August Algorithm Challenge
    • July Algorithm Challenge
    • June Algorithm Challenge
    • May Gamers Challenge
  • DISCUSS
    • Forums
    • Blog
    • Twitter
  • COMMUNITY
    • CodeChef TechTalks
    • CodeChef Meetups
    • Campus Chapters
    • Host Your Contest
    • User Groups
  • HELP
    • Frequently Asked Questions
    • FAQ for Problem Setters
    • Tutorial: Paying Up
    • Tutorial: Small Factorials
    • Tutorial: Input and Output(I/O)
    • Tutorial: Your First Non-Trivial Problem
  • ABOUT
    • About CodeChef
    • About Directi
    • CEO's Corner
    • Press Room
    • Careers

Home » Problems (easy) » Infinite Grid Game

Infinite Grid Game

Problem code: IGAME

  • Submit
  • All submissions

All submissions for this problem are available.

After a long period of relaxation Alice and Bob decided to play a game. This time of course not a number game. The rules of the game are as follows:

There is a vehicle situated at the point (m, n) of a rectangular grid. Only one corner of the rectangular grid is defined, i.e. the left-top point (0, 0), which is also known as the origin. The grid extends infinitely towards east and infinitely towards south. Alice and Bob are both sitting in a vehicle, initially situated at the point (m, n). The game they are playing ends as soon as one of them reaches (p, q).

Now, Alice and Bob have to drive the vehicle in their respective turn. In their own turn they can move the vehicle, from (x, y) to (x', y) or (x, y'); where p ≤ x' < x and q ≤ y' < y. They can also move the vehicle to the point (x-a, y-a), where 0 < a ≤ min(x-p, y-q). Also, 0 ≤ p < m and 0 ≤ q < n. The winner is the game is the one who drives the vehicle to (p, q).

Cunning Alice uses a biased coin for tossing purpose and always plays first. It is assumed that both Alice and Bob play optimally in their respective turns.

Input

The first line contains a single integer T denoting the number of test cases. T test cases follow. Each test case consists of a single line consisting of four space separated integers m, n, p, q respectively.

Output

For each test case print a string - either "Alice" or "Bob" (without the quotes), denoting the winner.

Constraints

1 ≤ T ≤ 1000
1 ≤ m, n ≤ 1000
0 ≤ p < m
0 ≤ q < n

Sample Input

2
1 1 0 0
2 4 1 2

Sample Output

Alice
Bob

Explanation

In the second test case, initially the vehicle is at co-ordinate (2, 4). Alice now has four possible moves. Alice can move the vehicle to position (1, 4), (1, 3), (2, 3) and (2, 2). For all moves that Alice can do, Bob can move the vehicle to the position (1, 2), winning the game.


Date:2011-07-07
Time limit:2s
Source limit:50000B
Languages:All


  • Submit

Comments

Loading Comments...

SUCCESSFUL SUBMISSIONS FOR THIS PROBLEM:

Loading Submissions...

RECENT ACTIVITY FOR THIS PROBLEM:

Loading Recent Activity...

HELP

Program should read from standard input and write to standard output.

After you submit a solution you can see your results by clicking on the [My Submissions] tab on the problem page. Below are the possible results:

  • Accepted Your program ran successfully and gave a correct answer. If there is a score for the problem, this will be displayed in parenthesis next to the checkmark.
  • Time Limit Exceeded Your program was compiled successfully, but it didn't stop before time limit. Try optimizing your approach.
  • Wrong Answer Your program compiled and ran succesfully but the output did not match the expected output.
  • Runtime Error Your code compiled and ran but encountered an error. The most common reasons are using too much memory or dividing by zero. For the specific error codes see the help section.
  • Compilation Error Your code was unable to compile. When you see this icon, click on it for more information.

If you are still having problems, see a sample solution here.

  • About CodeChef
  • About Directi
  • CEO's Corner
  • Careers
  • feedback@codechef.com

© 2009 Directi Group. All Rights Reserved. CodeChef uses SPOJ © by Sphere Research Labs

Sponsors
The time now is: