Under construction

Still being built. Things may change

Divisor Set Inclusion

Time limit1sMemory limit128 MB

Summary
Decide for each pair whether every divisor of a also divides b, which holds exactly when a divides b.
Level

Easy3 of 10

Topics
Number theory
Solved
No attempts yet

Problem

You are given two integers aa and bb. Determine whether the set of divisors of aa is contained in the set of divisors of bb.

Input

The first line contains a single integer zz (1≤z≤1061 \le z \le 10^6), the number of data sets. Each of the next zz lines describes one data set and contains two integers aa, bb (1≤a,b≤1091 \le a, b \le 10^9) separated by a space.

Output

Print zz lines. Each line contains the answer for one data set. If the set of divisors of aa is contained in the set of divisors of bb, print TAK; otherwise print NIE.

Examples1

  1. Example 1

    Input
    3
    2 3
    2 4
    4 10
    
    Expected output
    NIE
    TAK
    NIE