#include <iostream>

int divisorsSum( int x )
{
    int result = 1;
    int upperLimit = x / 2 + 1;
    
    for ( int d = 2; d < upperLimit; ++d )
    {
        if ( x % d == 0 )
        {
            result += d;
            result += (x / d);
            upperLimit = (x / d);
        }
    }

    return result;
}

void findNFriends( int n )
{
    int findedCount = 0;
    for ( int f = 220; ; ++f )
    {
        int s = divisorsSum( f );
        if ( (f < s) && (f % 2 == s % 2) && (f == divisorsSum( s )) )
        {
            ++findedCount;
            std::cout << "(" << f << ", " << s << ")" << std::endl;
            
            if ( findedCount >= n ) break;
        }
    }
}

int main() {
    findNFriends(14);
    return 0;
}