Problem: An agent called Cypher is decrypting a message, that contains a [composite number](https://en.wikipedia.org/wiki/Composite_number) n. All divisors of n, which are greater than 1, are placed in a circle. Cypher can choose the initial order of numbers in the circle.

In one move Cypher can choose two adjacent numbers in a circle and insert their [least common multiple](https://en.wikipedia.org/wiki/Least_common_multiple) between them. He can do that move as many times as needed.

A message is decrypted, if every two adjacent numbers are not coprime. Note that for such constraints it's always possible to decrypt the message.

Find the minimal number of moves that Cypher should do to decrypt the message, and show the initial order of numbers in the circle for that.

Input

The first line contains an integer t (1 ≤ t ≤ 100) — the number of test cases. Next t lines describe each test case.

In a single line of each test case description, there is a single composite number n (4 ≤ n ≤ 10^9) — the number from the message.

It's guaranteed that the total number of divisors of n for all test cases does not exceed 2 ⋅ 10^5.

Output

For each test case in the first line output the initial order of divisors, which are greater than 1, in the circle. In the second line output, the minimal number of moves needed to decrypt the message.

If there are different possible orders with a correct answer, print any of them.

Example

Input


3
6
4
30


Output


2 3 6 
1
2 4 
0
2 30 6 3 15 5 10 
0

Note

In the first test case 6 has three divisors, which are greater than 1: 2, 3, 6. Regardless of the initial order, numbers 2 and 3 are adjacent, so it's needed to place their least common multiple between them. After that the circle becomes 2, 6, 3, 6, and every two adjacent numbers are not coprime.

In the second test case 4 has two divisors greater than 1: 2, 4, and they are not coprime, so any initial order is correct, and it's not needed to place any least common multiples.

In the third test case all divisors of 30 greater than 1 can be placed in some order so that there are no two adjacent numbers that are coprime.

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;

public class CFJava1 {
	static PrintWriter out;
	static class FIO {
		BufferedReader in;
		StringTokenizer st;
		FIO() {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		}
		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(in.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt() {
			return Integer.parseInt(next());
		}
		long nextLong() {
			return Long.parseLong(next());
		}
	}
	static FIO in = new FIO();
	public static void main(String[] args) {
		int tc = in.nextInt();
		while (tc-- > 0)
			new solver();
		out.close();
	}
	static class solver {
		solver() {
			int N = in.nextInt();
			List<Integer> div = new ArrayList<>();
			TreeSet<Integer> ts = new TreeSet<>();
			for (int i = 1; i*i <= N; ++i) {
				if (N%i == 0) {
					ts.add(i);
					div.add(i);
					if (N/i != i) {
						ts.add(N/i);
						div.add(N/i);
					}
				}
			}
			Collections.sort(div);
			List<Integer> primes = new ArrayList<>();
			ts.remove(1);
			// doing a sieve for primes
			while (!ts.isEmpty()) {
				int x = ts.first();
				primes.add(x);
				ts.remove(x);
				if (ts.isEmpty())
					break;
				List<Integer> rem = new ArrayList<>();
				for (Integer el : ts) {
					if (el%x == 0)
						rem.add(el);
				}
				for (int el : rem)
					ts.remove(el);
			}
			int[] expo = new int[primes.size()];
			// stores how many powers of the prime are in N.
			for (int i = 0; i < primes.size(); ++i) {
				int x = primes.get(i);
				int cur = x;
				while (N%cur == 0) {
					expo[i]++;
					cur *= x;
				}
			}
			// if answer is 1, then case is trivial.
			
			
			// keeping guys that are divisible by pairs of primes.
			List<Integer> [][] pdiv = new ArrayList[primes.size()][primes.size()];
			for (int i = 0; i < primes.size(); ++i) {
				for (int j = i + 1; j < primes.size(); ++j) {
					pdiv[i][j] = new ArrayList<>();
					pdiv[j][i] = new ArrayList<>();
					for (int x : div) {
						if (x%(primes.get(i) * primes.get(j)) == 0) {
							pdiv[i][j].add(x);
							pdiv[j][i].add(x);
						}
					}
				}
			}
			if (div.size() == 4 && primes.size() == 2) {
				for (int i = 1; i < 4; ++i)
					out.print(div.get(i) + " ");
				out.println("\n" + 1);
				return;
			}
			if (primes.size() == 1) {
				int cur = 1;
				for (int i = 1; i <= expo[0]; ++i) {
					cur *= primes.get(0);
					out.print(cur + " ");
				}
				out.println("\n" + 0);
				return;
			}
			
			if (primes.size() == 2) {
				// p0^e0 * p1^e1, special case.
				int cur = 1;
				for (int i = 1; i <= expo[0]; ++i) {
					cur *= primes.get(0);
					out.print(cur + " ");
				}
				cur = 1;
				for (int i = 0; i < pdiv[0][1].size() - 1; ++i)
					out.print(pdiv[0][1].get(i) + " ");
				for (int i = 1; i <= expo[1]; ++i) {
					cur *= primes.get(1);
					out.print(cur + " ");
				}
				out.print(N);
				out.println("\n" + 0);
				return;
			}
			
			ts = new TreeSet<>();
			for (int x : div)
				ts.add(x);
			ts.remove(1);
			for (int i = 0; i < primes.size(); ++i) {
				int next = (i + 1)%primes.size();
				int prev = (i - 1 + primes.size())%primes.size();
				int cur = 1;
				for (int j = 0; j < expo[i]; ++j) {
					cur *= primes.get(i);
					out.print(cur + " ");
					ts.remove(cur);
				}
				for (int j = 0; j < primes.size(); ++j) {
					if (j == i || j == next)
						continue;
					if (j == ((i - 1 + primes.size())%primes.size())) continue;
					for (int x : pdiv[i][j]) {
						if (x%primes.get(prev) != 0 && x%primes.get(next) != 0) {
							if (!ts.contains(x)) continue;
							out.print(x + " ");
							ts.remove(x);
						}
					}
				}
				for (int x : pdiv[i][next]) {
					if (ts.contains(x)) {
						out.print(x + " ");
						ts.remove(x);
					}
				}
			}
			out.println("\n" + 0);
			
			
		}
	}
	// number of prime divisors is approx 10.
	// iterating over all pairs would be 100.
	// checking would thus be 10^6.5, sufficient.
	// 1 50

}