#include <iostream>
#include <cmath>
using namespace std;
const int N=11000;
bool st[N];
int yueshusum(int n)
{
int sum = 1; //从1开始,否则for从1开始会加上数字本身
for (int i = 2; i <= sqrt(n); i ++) //别写成n/2!!!
{
if (n % i == 0 && (n/i!=i))
{
sum += i;
sum += n / i;
}
}
return sum;
}
int main()
{
for (int i = 1; i <= 10000; i ++)
{
int x = yueshusum(i);
int y = yueshusum(x);
if (i == y && !st[x] && !st[y] && x!=y)
{
st[x]=true;
st[y]=true;
cout<<x<<" "<<y<<endl;
}
}
return 0;
}