z-shortest
Mr. Little Z got tired of writing long problem text, so he decided to give you a problem with the shortest text possible:
For given positive integer n find two positive integers a and b such that a^b = n. If there are multiple solutions, give the one with the smallest value of a.
InputFrom the first line of the standard input read one integer k, (1 <= k <= 1000000), k represents the number of digits of n. From the second line read k characters that represent the number n. n will be greater than 1.
OutputTo the standard output, in one line, write two integers a and b
Input:
Output:
2
10Output:
10 1Input:
Output:
2
16Output:
2 4Input:
Output:
2
27Output:
3 3Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.