#include <iostream>
using namespace std;
// 因子之和
int getsum(int num)
{
int ans = 0;
for (int i = 1; i < num; i++)
{
if (num % i == 0)
ans += i;
}
return ans;
}
int main()
{
for (int a = 2; a < 100000; a++)
{
int b = getsum(a);
int c = getsum(b);
if (c == a && a != b)
{
cout << a << " " << b;
return 0;
}
}
return 0;
}