#include <bits/stdc++.h>
    using namespace std;
    int main(){
    int a,b,c,d,e,f,g=1000,h,i;
    for(;g<=9999;g++) {
        a=g%10;
        b=g/10%10; 
        c=g/100%10;
        d=g/1000;
        e=a+b*10;
        f=c+d*10;
        if((e+f)*(e+f)==g){
        cout<<g<<endl;}
    }
     
     
     
     
     
     
     
    }
/**************************************************************
	Problem: 1085
	User: chenmingyu
	Language: C++
	Result: Accepted
	Time:4 ms
	Memory:2072 kb
****************************************************************/