1.

/**Angewandte Mathematik, SS11
* Problem: 11970 - Lucky Numbers
* Link: http://uva.onlinejudge.org/external/119/11970.html
*
* @author Ritter Marius
* @author Wende Tom
* @author Zehentbauer Stefan
* @version 2.0, 05/30/2011
*
* Method : Pow
* Status : Accepted
* Runtime: 0.240
*/

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
StringBuffer out = new StringBuffer();
Scanner _scan = new Scanner(System.in);
int zeahler = _scan.nextInt() + 1;
int N = 0;
for (int i = 1; i != zeahler; i++) {
N = _scan.nextInt();

int bis = (int) Math.sqrt(N) - 1;

out.append("Case " + i + ":");

for (int x = bis; x != 0; x--) {
if (N % x == 0) {
out.append(" " + (int)(N - Math.pow(x, 2)));

}

}
out.append("\n");
}
System.out.print(out);
}
}