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:
// package CodeForces;

import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.LinkedList;

public class Round671E {

	public static final int max = (int)1e5;
	
	public static void solve() {
		int t = s.nextInt();
		boolean[] seive = new boolean[max];
		for(long i = 2; i < max; i++) {
			if(!seive[(int)i]) {
				for(long j = i * i; j < max; j += i) {
					seive[(int)j] = true;
				}
			}
		}
		while(t-- > 0) {
			int n = s.nextInt();
			HashMap<Integer, Integer> factors = new HashMap<Integer, Integer>();
			for(long i = 2; i * i <= n; i++) {
				if(n%i == 0) {
					if(!seive[(int)i]) {
						int count = 0;
						while(n%i == 0) {
							n = n/(int)i;
							count++;
						}
						factors.put((int)i, count);
					}
				}
			}
			if(n > 1) {
				factors.put(n, 1);
			}
			int[] values = new int[factors.size()];
			int[] times = new int[factors.size()];
			int pos = 0;
			for(Integer x : factors.keySet()) {
				values[pos] = x;
				times[pos++] = factors.get(x);
			}
			multiples = new ArrayList<Integer>();
			if(values.length == 1) {
				Recur(values, times, 1, 0);
				for(Integer x : multiples) {
					if(x != 1) out.print(x + " ");
				}
				out.println();
				out.println(0);
				continue;
			}
			LinkedList<Integer> ans = new LinkedList<Integer>();
			LinkedList<Integer> before = new LinkedList<Integer>();
			LinkedList<Integer> middle = new LinkedList<Integer>();
			LinkedList<Integer> after = new LinkedList<Integer>();
			int before_me = values[values.length - 1];
			int after_me = values[1];
			times[0]--;
			Recur(values, times, 1, 0);
			for(Integer x : multiples) {
				x *= values[0];
				if(after.size() == 0 && x%after_me == 0) {
					after.add(x);
				}else if(before.size() == 0 && x%before_me == 0) {
					before.add(x);
				}else {
					middle.add(x);
				}
			}
			for(Integer x : before) {
				ans.add(x);
			}
//			ans.add(values[0]);
			for(Integer x : middle) {
				ans.add(x);
			}
			for(Integer x : after) {
				ans.add(x);
			}
			times[0] = 0;
			for(int j = 1; j < values.length - 1; j++) {
				int next = values[j + 1];
				after = new LinkedList<Integer>();
				middle = new LinkedList<Integer>();
				times[j]--;
				multiples = new ArrayList<Integer>();
				Recur(values, times, 1, j);
				for(Integer x: multiples) {
					x *= values[j];
					if(after.size() == 0 && x%next == 0) {
						after.add(x);
					}else {
						middle.add(x);
					}
				}
//				ans.add(values[j]);
				for(Integer x : middle) {
					ans.add(x);
				}
				for(Integer x : after) {
					ans.add(x);
				}
				times[j] = 0;
			}
//			ans.add(values[values.length - 1]);
			int val = values[values.length - 1];
			int curr = 1;
			for(int i = 1; i <= times[values.length - 1]; i++) {
				curr *= val;
				ans.add(curr);
			}
			int count = 0;
			int last = ans.peekFirst();
			boolean first = false;
			for(Integer x : ans) {
				if(!first) {
					first = true;
				}else {
					count += gcd(last, x) > 1 ? 0 : 1;
					last = x;
				}
			}
			count += gcd(ans.peekFirst(), ans.peekLast()) > 1 ? 0 : 1;
//			out.println(ans.size());
			for(Integer x : ans) {
				out.print(x + " ");
			}
			out.println();
			out.println(count);
		}
	}
	
	public static int gcd(int a, int b) {
		if(a == 0) {
			return b;
		}
		return gcd(b%a, a);
	}
	
	public static ArrayList<Integer> multiples;
	
	public static void Recur(int[] values, int[] times, int val, int pos) {
		if(values.length == pos) {
				multiples.add(val);
			return;
		}
		int mul = 1;
		for(int i = 0; i <= times[pos]; i++) {
			Recur(values, times, val * mul, pos + 1);
			mul *= values[pos];
		}
	}
	
	public static int LPF(int n) {
		for(long i = 2; i * i <= n; i++) {
			if(n%i == 0) {
				return (int)i;
			}
		}
		return n;
	}

	public static void main(String[] args) {
		new Thread(null, null, "Thread", 1 << 27) {
			public void run() {
				try {
					out = new PrintWriter(new BufferedOutputStream(System.out));
					s = new FastReader(System.in);
					solve();
					out.close();
				} catch (Exception e) {
					e.printStackTrace();
					System.exit(1);
				}
			}
		}.start();
	}

	public static PrintWriter out;
	public static FastReader s;

	public static class FastReader {

		private InputStream stream;
		private byte[] buf = new byte[4096];
		private int curChar, snumChars;

		public FastReader(InputStream stream) {
			this.stream = stream;
		}

		public int read() {
			if (snumChars == -1) {
				throw new InputMismatchException();
			}
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException E) {
					throw new InputMismatchException();
				}
			}
			if (snumChars <= 0) {
				return -1;
			}
			return buf[curChar++];
		}

		public int nextInt() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int number = 0;
			do {
				number *= 10;
				number += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return number * sgn;
		}

		public long nextLong() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			long sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long number = 0;
			do {
				number *= 10L;
				number += (long) (c - '0');
				c = read();
			} while (!isSpaceChar(c));
			return number * sgn;
		}

		public int[] nextIntArray(int n) {
			int[] arr = new int[n];
			for (int i = 0; i < n; i++) {
				arr[i] = this.nextInt();
			}
			return arr;
		}

		public long[] nextLongArray(int n) {
			long[] arr = new long[n];
			for (int i = 0; i < n; i++) {
				arr[i] = this.nextLong();
			}
			return arr;
		}

		public String next() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public String nextLine() {
			int c = read();
			while (isSpaceChar(c)) {
				c = read();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndofLine(c));
			return res.toString();
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public boolean isEndofLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}

	
}