import java.util.*;
import java.lang.*;
import java.io.*;
class Ideone
{
static int sum_dividers(int n){
int sum=0;
for(int i
=1; i
<Math.
sqrt(n
); i
++){ if((n%i)==0)sum+=i+(n/i);
}
if(i*i==n)sum+=i;
return sum;
}
{
Scanner in
= new Scanner
(System.
in); int n=in.nextInt();
int max_sum=0;
int max_number=0;
int j;
for(j=1; j<=n; j++){
int s=sum_dividers(j);
if(max_sum<s){
max_sum=s;
max_number=j;
}
}
System.
out.
println(max_number
+" "+max_sum
); }
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CgpjbGFzcyBJZGVvbmUKewoJc3RhdGljIGludCBzdW1fZGl2aWRlcnMoaW50IG4pewoJCWludCBzdW09MDsKICAgIAkJZm9yKGludCBpPTE7IGk8TWF0aC5zcXJ0KG4pOyBpKyspewogICAgICAgIAkJCWlmKChuJWkpPT0wKXN1bSs9aSsobi9pKTsKICAgIAkJfQogICAgCQlkb3VibGUgaT1NYXRoLnJvdW5kKE1hdGguc3FydChuKSk7CiAgICAJCWlmKGkqaT09bilzdW0rPWk7CiAgICAJCXJldHVybiBzdW07Cgl9CgkKCXB1YmxpYyBzdGF0aWMgdm9pZCBtYWluIChTdHJpbmdbXSBhcmdzKSB0aHJvd3MgamF2YS5sYW5nLkV4Y2VwdGlvbgoJewoJCVNjYW5uZXIgaW4gPSBuZXcgU2Nhbm5lcihTeXN0ZW0uaW4pOwoJCWludCBuPWluLm5leHRJbnQoKTsKCQlpbnQgbWF4X3N1bT0wOwoJCWludCBtYXhfbnVtYmVyPTA7CgkJaW50IGo7CgkJZm9yKGo9MTsgajw9bjsgaisrKXsKCQkJaW50IHM9c3VtX2RpdmlkZXJzKGopOwoJCQlpZihtYXhfc3VtPHMpewogICAgICAgICAgICAJCQltYXhfc3VtPXM7CiAgICAgICAgICAgIAkJCW1heF9udW1iZXI9ajsKCQkJfQoJCX0KCQlTeXN0ZW0ub3V0LnByaW50bG4obWF4X251bWJlcisiICIrbWF4X3N1bSk7Cgl9Cn0=