Surrounded by Primes

4

3 votes
Easy
Problem

Abhi is playing with numbers, he chooses a number and want the prime numbers which surround it

For example:
        6 is surrounded by 5 and 7

And if a prime number is chosen then it is consider to be surrounded by itself and a prime number just greater than this number.

As Abhi is week in doing calculations so he want your help.

Input Format :

First line contains an Integer T indicating the number of test cases, and then each line contain a number N.

Output Format:

For each test case ,output two space separated integers ( smaller first ) showing the surrounded primes of N.

Constraints:

1 ≤ T ≤ 100

1 ≤ N ≤ 10000

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?