// Arup Guha
// 10/1/2026
// Meet in the Middle Strategy
// https://codeforces.com/problemset/problem/1263/C

import java.util.*;

public class everyonewinner {

	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		
		int nC = stdin.nextInt();
		for (int loop=0; loop<nC; loop++) {
		
			int n = stdin.nextInt();
			TreeSet<Integer> res = new TreeSet<Integer>();
			
			// Get all the big numbers.
			int i = 1;
			while (i*i <= n) {
				res.add(n/i);
				i++;
			}
			
			// Try all the other values.
			for (i=1; i*i<n; i++) {
			
				// less than or equal to this.
				int upper = n/i;
				
				// Greater than or equal to this.
				int lower = n/(i+1)+1;
				
				// There exists a k that works.
				if (lower <= upper) res.add(i);
			}
			
			// They want this.
			res.add(0);
			
			// Output.
			System.out.println(res.size());
			StringBuffer sb = new StringBuffer();
			for (Integer x: res)
				sb.append(x+" ");
			System.out.println(sb);
		}
	}
}
