import java.util.Arrays;

public class Main {
    /** precision od calculating squares */ 	
    public static final double EPS = 0.0000001;
    /** Max number to check - 1000000 */
    public static final int MAX_LEN = 6;

    public static void main(String... args) {
        int sum;
        long test;
        String numberS;
        long max = (long)Math.pow(10, MAX_LEN);
        for (int i = 1;i<=max; i++) {
            numberS = "" + i;
            /* get the sum of digits */
            sum = sumOfDigits(i);
            for (int j = 0; j <= numberS.length(); j++) {
                test =
                        Long.parseLong(numberS.substring(0, j) + sum
                                + numberS.substring(j));
                if (isSquare(test))
                    System.out.println("Dla liczby: " + numberS
                            + " kwadratem jest: " + test);
            }
        }
    }
    /** 
     * returns sum of digits of number
     */
    private static int sumOfDigits(long number) {
        String str = "" + number;
        int sum = 0;
        for (int i = 0; i < str.length(); i++) {
            sum += Integer.parseInt("" + str.charAt(i));
        }
        return sum;
    }

    /**
     * returns true if sqrt(n) is an integer
     */ 
    private static boolean isSquare(long n) {
        double sqrt = Math.sqrt(n);
        if (Math.abs(sqrt - (long) sqrt) > EPS) {
            return false;
        } else {
            return true;
        }
    }
}