#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    while(cin >> n)
    {
        for(int i = 1; i <= n; i++)
        {
            int sum = 0;
            for(int j = 1; j < i; j++)
            {
                if(i % j == 0) sum += j;
            }
            if(sum == i) cout << i << " ";
        }
        cout << "\n";
    }
    return 0;
}