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.util.*;
import java.io.*;

public class E {
	public static void main(String[] args) throws Exception {
		int t = i();
		for (int tt = 0; tt < t; tt++) {
			int x = i();
			ArrayList<Pair> primes = new ArrayList<>();
			factor(x, primes);

			if (primes.size() == 2 && primes.get(0).s == 1 && primes.get(1).s == 1) {
				int p = primes.get(0).f, q = primes.get(1).f;
				out.println(p + " " + q + " " + x);
				out.println(1);
				continue;
			}

			assert(primes.size() < 20);

			int numPrimes = primes.size();
			// out.println(primes);
			TreeSet<Tuple>[] tuples = new TreeSet[numPrimes];
			for (int i = 0; i < numPrimes; i++) {
				TreeSet<Tuple> set = new TreeSet<>();
				Tuple cur = new Tuple(numPrimes);

				primes.get(i).s--;
				generateTuples(primes, cur, 0, set);
				primes.get(i).s++;
				for (Tuple tpl : set) {
					tpl.inc(i);
				}

				tuples[i] = set;
				// out.println(i);
				// for (Tuple tpl : set) {
				// 	out.println(tpl);
				// }
			}

			Tuple curTpl = new Tuple(numPrimes);
			curTpl.inc(0);
			ArrayList<Tuple> ans = new ArrayList<>();
			ans.add(new Tuple(curTpl));
			for (int i = 0; i < numPrimes; i++) {
				tuples[i].remove(curTpl);
			}
			while (true) {
				int best = -1;
				for (int i = 0; i < numPrimes; i++) {
					assert(curTpl.get(i) >= 0);
					if (curTpl.get(i) == 0 || tuples[i].isEmpty()) {
						continue;
					}
					if (best == -1 || tuples[i].first().compareTo(tuples[best].first()) < 0) {
						best = i;
					}
				}
				if (best == -1) break;
				assert(best != -1);
				Tuple bestTpl = tuples[best].first();
				for (int i = 0; i < numPrimes; i++) {
					tuples[i].remove(bestTpl);
				}
				ans.add(bestTpl);
				curTpl = bestTpl;
			}

			for (Tuple tpl : ans) {
				int val = 1;
				for (int i = 0; i < numPrimes; i++) {
					for (int j = 0; j < tpl.get(i); j++) {
						val *= primes.get(i).f;
					}
				}
				out.print(val + " ");
			}
			out.println();
			out.println(0);
		}
		
		finish();
	}

	static class Tuple implements Comparable<Tuple> {
		int sz;
		protected int[] data;
		int sum;
		public Tuple(int sz) {
			this.sz = sz;
			this.data = new int[sz];
		}

		public Tuple(Tuple tpl) {
			this.sz = tpl.sz;
			this.data = tpl.data.clone();
			this.sum = tpl.sum;
		}

		public int get(int i) {
			return data[i];
		}

		public void inc(int i) {
			data[i]++;
			sum++;

		}

		public void dec(int i) {
			data[i]--;
			sum--;
		}

		public int compareTo(Tuple o) {
			if (sum != o.sum) return sum - o.sum;
			assert(sz == o.sz);
			for (int i = 0; i < sz; i++) {
				if (data[i] != o.data[i]) return data[i] - o.data[i];
			}
			return 0;
		}

		public String toString() {
			return Arrays.toString(data);
		}

		public int hashCode() {
			return Arrays.hashCode(data);
		}

		public boolean equals(Object o) {
			return o instanceof Tuple && Arrays.equals(data,  ((Tuple) o).data);
		}
	}

	static void generateTuples(ArrayList<Pair> primes, Tuple cur, int i, Set<Tuple> dest) {
		if (i >= primes.size()) {
			dest.add(new Tuple(cur));
			return;
		}

		for (int j = 0; j <= primes.get(i).s; j++) {
			generateTuples(primes, cur, i + 1, dest);
			cur.inc(i);
		}
		for (int j = 0; j <= primes.get(i).s; j++) {
			cur.dec(i);
		}
	}

	static void factor(int x, ArrayList<Pair> primes) {
		int cur = 2;
		while (cur * cur <= x) {
			while (x % cur == 0) {
				if (primes.isEmpty() || primes.get(primes.size() - 1).f != cur) {
					primes.add(new Pair(cur, 1));
				} else {
					primes.get(primes.size() - 1).s++;
				}
				x /= cur;
			}
			cur++;
		}
		if (x > 1) {
			if (primes.isEmpty() || primes.get(primes.size() - 1).f != x) {
				primes.add(new Pair(x, 1));
			} else {
				primes.get(primes.size() - 1).s++;
			}
		}
	}

	static class Pair implements Comparable<Pair> {
		public int f, s;
		public Pair(int i, int j) {
			f = i; s = j;
		}
		public int compareTo(Pair other) {
			return f == other.f ? s - other.s : f - other.f;
		}
		public String toString() {
			return "(" + f + ", " + s + ")";
		}
	}

	static BufferedReader in;
	static StringTokenizer st = new StringTokenizer("");
	static PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
	static {
		try {
			in = new BufferedReader(new FileReader("test.in"));
		} catch (Exception e) {
			in = new BufferedReader(new InputStreamReader(System.in));
		}
	}
	static void check() throws Exception {
		while (!st.hasMoreTokens()) st = new StringTokenizer(in.readLine());
	}
	static int i() throws Exception {check(); return Integer.parseInt(st.nextToken());}
	static String s() throws Exception {check(); return st.nextToken();}
	static double d() throws Exception {check(); return Double.parseDouble(st.nextToken());}
	static long l() throws Exception {check(); return Long.parseLong(st.nextToken());}
	static int[] a(int n) throws Exception {check(); int[] b = new int[n]; for (int i = 0; i < n; i++) b[i] = i(); return b;}
	static void finish(boolean b, Object o) {if (b) finish(o);}
	static void finish(Object o) {out.println(o); finish();}
	static void finish() {out.close(); System.exit(0);}
}