308625: CF1549A. Gregor and Cryptography

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Gregor and Cryptography

题意翻译

Gregor 有一个质数 $P$($5\leq P\leq 10^9$),他希望你找到两个基数。假设这两个基数为 $x,y$,让它们满足以下条件: - $P$ 除以 $x$ 的余数等于 $P$ 除以 $y$ 的余数。 - $2\leq x < y\leq P$。 - **本题有多组输入数据**,对于每组输入数据都输出一行 $2$ 个数,若有多组答案输出任意一组即可。

题目描述

Gregor is learning about RSA cryptography, and although he doesn't understand how RSA works, he is now fascinated with prime numbers and factoring them. Gregor's favorite prime number is $ P $ . Gregor wants to find two bases of $ P $ . Formally, Gregor is looking for two integers $ a $ and $ b $ which satisfy both of the following properties. - $ P \bmod a = P \bmod b $ , where $ x \bmod y $ denotes the remainder when $ x $ is divided by $ y $ , and - $ 2 \le a < b \le P $ . Help Gregor find two bases of his favorite prime number!

输入输出格式

输入格式


Each test contains multiple test cases. The first line contains the number of test cases $ t $ ( $ 1 \le t \le 1000 $ ). Each subsequent line contains the integer $ P $ ( $ 5 \le P \le {10}^9 $ ), with $ P $ guaranteed to be prime.

输出格式


Your output should consist of $ t $ lines. Each line should consist of two integers $ a $ and $ b $ ( $ 2 \le a < b \le P $ ). If there are multiple possible solutions, print any.

输入输出样例

输入样例 #1

2
17
5

输出样例 #1

3 5
2 4

说明

The first query is $ P=17 $ . $ a=3 $ and $ b=5 $ are valid bases in this case, because $ 17 \bmod 3 = 17 \bmod 5 = 2 $ . There are other pairs which work as well. In the second query, with $ P=5 $ , the only solution is $ a=2 $ and $ b=4 $ .

Input

题意翻译

Gregor 有一个质数 $P$($5\leq P\leq 10^9$),他希望你找到两个基数。假设这两个基数为 $x,y$,让它们满足以下条件: - $P$ 除以 $x$ 的余数等于 $P$ 除以 $y$ 的余数。 - $2\leq x < y\leq P$。 - **本题有多组输入数据**,对于每组输入数据都输出一行 $2$ 个数,若有多组答案输出任意一组即可。

加入题单

上一题 下一题 算法标签: