#P5973. [PA 2013] Iloczyn

[PA 2013] Iloczyn

Problem Description

Given positive integers nn and kk, determine whether nn can be factored into a product of kk distinct positive integers.

Input Format

The first line contains an integer TT, the number of test cases.

The next TT lines each contain two integers n,kn, k.

Output Format

Output TT lines. If nn can be factored as required, output TAK; otherwise output NIE.

3
15 2
24 4
24 5
TAK
TAK
NIE

Hint

Constraints: for 100%100\% of the testdata, 1T4×1031 \le T \le 4 \times 10^3, 1n1091 \le n \le 10^9, 1k201 \le k \le 20.

Translated by ChatGPT 5