CF1968A.Maximize?

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Maximize?

You are given an integer xx. Your task is to find any integer yy (1y<x)(1\le y \lt x) such that gcd(x,y)+y\gcd(x,y)+y is maximum possible.

Note that if there is more than one yy which satisfies the statement, you are allowed to find any.

gcd(a,b)\gcd(a,b) is the Greatest Common Divisor of aa and bb. For example, gcd(6,4)=2\gcd(6,4)=2.

Input

The first line contains a single integer tt (1t10001 \le t \le 1000) — the number of test cases.

Each of the following tt lines contains a single integer xx (2x10002 \le x \le 1000).

Output

For each test case, output any yy (1y<x1 \le y \lt x), which satisfies the statement.

Samples

7
10
7
21
100
2
1000
6
5
6
18
98
1
750
3

在线编程 IDE

建议全屏模式获得最佳体验