#P6659. [POI 2019/2020 R1] Najmniejsza wspólna wielokrotność / 最小公倍数
[POI 2019/2020 R1] Najmniejsza wspólna wielokrotność / 最小公倍数
Background
Byteasar is preparing for his math exam.
Problem Description
The teacher told him that the exam would include problems about the least common multiple , so he found a problem to practice.
Given an integer , find an interval such that is the least common multiple of all integers in this interval.
Since you are very strong, while Byteasar was solving this problem, he also wanted to ask you for the answer to this problem.
Because Byteasar loves asking questions, he will ask you queries.
Input Format
The first line contains an integer , the number of queries.
Then follow lines, each containing an integer for one query.
Output Format
Output lines, each containing two integers , the answer for one query.
If there are multiple solutions:
- Output the one with the smallest .
- If there are still multiple solutions, output the one with the smallest .
If there is no solution, output NIE.
3
12
504
17
1 4
6 9
NIE
5
5
6
7
8
9
NIE
1 3
NIE
NIE
NIE
1
1000000
NIE
1
99999990000000
9999999 10000000
Hint
Sample Explanation
For the first query in sample , is the least common multiple of the interval .
Another additional sample is provided in the attached files sample.in and sample.out.
Constraints
This problem uses bundled testdata.
- Subtask 1 (18 pts): , .
- Subtask 2 (20 pts): , .
- Subtask 3 (20 pts): , .
- Subtask 4 (42 pts): no special limits.
For of the testdata, , .
Note
Translated from POI 2019 A Najmniejsza wspólna wielokrotność.
Translated by ChatGPT 5