Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

MB1CH - PP numbers

PP numbers are prime numbers and palindromes in decimal notation at once. Your task is to find n-th PP number in ascending order. Then calculate product of its non-zero digits - let's call it m - and find m-th prime number in ascending order.

Input

In the first line of input there is one positive integer Z (1 ≤ Z ≤ 1000) which states the number of test cases. Following Z lines contain test cases.

Each test case consists of one positive integer n (1 ≤ n ≤ 113) which states the number of PP number to find.

Output

For each test case print in separate line two numbers: n-th PP number and m-th prime number.

Score

Score equals to size (in bytes) of source code of your program. The fewer points you score, the better.

Example

Input:

3
1
5
2

Output:

2 3
11 2
3 5

Added by:Maciej Boniecki
Date:2010-09-18
Time limit:3.150s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: SCM qobi
Resource:2nd Warsaw School of Computer Science Programming Championship

hide comments
2010-09-23 03:05:33 :(){ :|: & };:

Hm.. then the time limit is not good for shortening task I guess, you should leave option such that a naive prime generator should pass :-)
2010-09-22 23:24:11 Maciej Boniecki
Yes, If you will get rid of preprocessed results. Time limit is 10s so there is no need to do this.
2010-09-22 14:48:12 :(){ :|: & };:

Is this really a shortening task ?

Last edit: 2010-09-22 14:48:28
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.