#include<iostream>
using namespace std;
#include<cmath>
int main(){
for (int i = 1; i <= 9; i++) {
for (int j = 0; j < +9; j++) {
int n = i * 1000 + i * 100 + j * 10 + j;
int m = floor(sqrt(n) + 0.5);
if (n == m*m) {
cout << n << endl;
}
}
}
return 0;
}