This page is still under construction.

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

Bookmakers

Interview

Time limit1sMemory limit128 MB

Summary
Decide whether stakes on both match outcomes can guarantee a profit given decimal odds X and Y.
Level

Easy2 of 10

Topics
Math
Solved
No attempts yet

Problem

Hector's father has recently taken an interest in sports betting. Soon there will be a match between team Alfa and team Beta.

A nearby bookmaker pays XX zł for every złoty staked on Alfa winning, if Alfa wins the match. Likewise, if Beta wins, the bookmaker pays YY zł for every złoty staked on that outcome. (The match cannot end in a draw.)

Hector's father does not want to risk losing money. He wants to know whether he can choose an amount AA to stake on Alfa winning and an amount BB to stake on Beta winning so that, no matter how the match ends, he receives back strictly more than A+BA+B.

Write a program that decides whether this is possible.

Input

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

Each of the next ZZ lines contains two real numbers XX (1<X≤10001 < X \le 1000) and YY (1<Y≤10001 < Y \le 1000), each given with exactly two digits after the decimal point.

Output

For each test case, print on its own line:

  • TAK if the money can be staked in a way that guarantees a profit
  • NIE otherwise

Examples1

  1. Example 1

    Input
    4
    1.50 5.00
    1.90 1.90
    2.00 2.00
    2.01 2.00
    
    Expected output
    TAK
    NIE
    NIE
    TAK