This page is still under construction.

Parts of this page are still being built. What you see may change.

Rock Paper Scissors

Interview

Time limit1sMemory limit128 MB

Summary
Compare the two players' winning chances from their move probabilities and print who is more likely to win each match.
Level

Easy2 of 10

Topics
Probability, Math, Implementation
Solved
No attempts yet

Problem

Adam and Gosia play Rock Paper Scissors.

In each round both players simultaneously choose paper, rock, or scissors.

  • Paper beats rock.
  • Rock beats scissors.
  • Scissors beats paper.

If both players choose the same move, that round is replayed until someone wins.

Given the probability with which each player chooses paper, rock, and scissors, determine which player is more likely to win the match.

Input

The first line contains the number of test cases ZZ (1≤Z≤101 \le Z \le 10).

Each test case consists of two lines. The first line contains three real numbers X1 Y1 Z1X_1\ Y_1\ Z_1 (0≤X1,Y1,Z1≤10 \le X_1, Y_1, Z_1 \le 1, X1+Y1+Z1=1X_1 + Y_1 + Z_1 = 1): the probabilities that Adam chooses paper, rock, and scissors respectively. The second line contains three real numbers X2 Y2 Z2X_2\ Y_2\ Z_2 (0≤X2,Y2,Z2≤10 \le X_2, Y_2, Z_2 \le 1, X2+Y2+Z2=1X_2 + Y_2 + Z_2 = 1): the probabilities that Gosia chooses paper, rock, and scissors respectively.

Output

For each test case, print one line:

  • ADAM if Adam is more likely to win,
  • GOSIA if Gosia is more likely to win,
  • = if both players have an equal chance of winning.

Examples1

  1. Example 1

    Input
    3
    0.34 0.33 0.33
    0.00 0.00 1.00
    0.50 0.50 0.00
    0.33 0.33 0.34
    1.00 0.00 0.00
    0.00 1.00 0.00
    
    Expected output
    GOSIA
    =
    ADAM