#include <iostream>
#include <string>
using namespace std;

int check(int m) {
    string str1 = to_string(m * m);
    for (int i = 0, j = str1.length() - 1; i <= (str1.length() / 2); i++, j--) {
        if (str1[i] == str1[j])
            continue;
        else
            return 0;
    }
    return 1;
}

int main() {
    for (int i = 0; i <= 256; ++i) {
        if (check(i))
            cout << i << endl;
    }
    return 0;
}