import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.NavigableSet;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;
import java.util.SortedSet;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeSet;
public class Main {
static{
}
public static void main(String[] args) throws IOException{
StreamTokenizer cin = new StreamTokenizer(new BufferedInputStream(System.in));
InputReader in = new InputReader(System.in) ;
PrintWriter out = new PrintWriter(System.out) ;
while(cin.nextToken() != cin.TT_EOF){
new Task().solve((long)cin.nval , out) ;
}
out.flush();
}
}
class Task{
long n ;
long pow(long x , long y){
long s = 1 ;
for( ; y > 0 ; y >>= 1){
if((y & 1) > 0) s *= x ;
x *= x ;
}
return s ;
}
long getK(long R){
long l = 2 , r = (long)Math.pow(n , 1.0/R) ;
while(l <= r){
long mid = (l + r) >> 1 ;
long k = mid ;
long sum = (pow(k , R) - 1) * k / (k - 1) ;
if(sum == n || sum == n-1) return mid ;
else if(sum < n-1) l = mid + 1 ;
else r = mid - 1 ;
}
return -1 ;
}
public void solve(long n , PrintWriter out){
this.n = n ;
long ansK = n-1 ;
long ansR = 1 ;
for(long r = 2 ; r <= 45 ; r++){
long k = getK(r) ;
if(k != -1 && k * r < ansK * ansR){
ansK = k ;
ansR = r ;
}
}
out.println(ansR + " " + ansK) ;
}
}
class InputReader{
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream){
reader = new BufferedReader(new InputStreamReader(stream), 32768) ;
tokenizer = null ;
}
public String next(){
while(tokenizer == null || ! tokenizer.hasMoreTokens()){
try{
tokenizer = new StringTokenizer(reader.readLine());
}catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt(){
return Integer.parseInt(next());
}
public long nextLong(){
return Long.parseLong(next());
}
public double nextDouble(){
return Double.parseDouble(next());
}
}