#include <iostream>
#include <cmath>
using namespace std;
/*
long long max(long long n)
{
long long i=2;
while(n != 1)
{
while (n % i == 0)
n /= i;
i++;
}
return i-1;
}
*/
// return the max prime factor of n
long long max(long long n)
{
long long i=2;
long long m = (long long)sqrt(n);
while(i <= m)
{
if (n % i == 0)
{
n /= i;
m = (long long)sqrt(n);
}
else {
i++;
}
}
return n;
}
int main()
{
cout << max(13195) << endl;
cout << max(600851475143LL) << endl;
return 0;
}