#include <stdio.h>

long const LIMIT = 10e8;

long power(long base, long exp)
{
    long i, res = 1;
    for(i = 0; i < exp; i++)
    {
        res *= base;
    }

    return res;
}

int getDigitCount(long n)
{
    int count = 0;
    while(n > 0)
    {
        n /= 10;
        count++;
    }

    return count;
}

int isKapernak(long n)
{
    int digitCount = getDigitCount(n);
    long square = n * n;
    long left = square / 10;
    long right = square % 10;
    
    int i = 0;
    while(i < digitCount)
    {
        if(left + right == n)
            return 1;
        
        right = (left % 10) * power(10, ++i) + right;
        left = left / 10;
    }

    return 0;
}

int main(int argc, char *argv[])
{
    long n, i;
    scanf("%ld", &n);

    for(i = 1; i < n; i++)
    {
        if(isKapernak(i))
            printf("%ld\n", i);
    }


    return 0;
}