Wjc loves Euler's totient function. One day, he noticed such a problem on bitoj, whose statement is:
"For a given , calculated the value of
, where
is equal to the number of
such that
and
. For example,
and
."
Since this problem is exactly about Euler's totient function, Wjc solved it with O(1) complexity by his mouth. However, such an easy problem didn't satisfy him and he prepared another problems by himself.
Now, this new problem satisfied him a lot and he wondered if you're a real genius(when we say "real genius", it just means "as clever as wjc") that you are able to solve this problem.
The problem is, for a positive interger , we define
as :
Since wjc don't like ,the domain of
is all intergers except one. That is,
is an illegal value for
.
Based on the defination of , two problems are put forward by wjc and they are:
You are supposed to answer the such that
achieve the MININUM value of
where
. If there are mutiple
that can make
as small as possible, print the MININUM one.
You are supposed to answer the such that
achieve the MAXINUM value of
where
. If there are mutiple
that can make
as big as possible, print the MAXINUM one.
The first line contains a single interger
, which means the numbers of test case.
For the next
lines, each line contains a single interger
, the numbers that wjc gives you.
For each test, you are supposed to output two space-separated number, where the first number is your answer to the first problem of wjc and vice versa.
If
, just output
to show
is undefined.
The value of
where
range from
to
are
.
Please note that both
and
can make
achieve his mininum value, and the answer should be the mininum one and that is
.