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 Main {
	public static void main(String[] args) throws Exception {

		int t=sc.nextInt();
		while(t-->0) {
			ArrayList<Integer>a=new ArrayList<Integer>();
			int n=sc.nextInt();
			for(int i=2;i*i<=n;i++) {
				if(i*i==n) {
					a.add(i);
					continue;
				}
				if(n%i==0) {
					a.add(i);
					a.add(n/i);
				}
			}
			Collections.sort(a);
			boolean[]visited=new boolean[a.size()];
			ArrayList<Integer>ans=new ArrayList<Integer>();
			ArrayList<Integer>prime=new ArrayList<Integer>();
			for(int i=0;i<a.size();i++) {
				if(isprime(a.get(i))) {
					prime.add(a.get(i));
					visited[i]=true;
				}
			}
//			pw.println(a);
			int nn=n;
			ans.add(n);
			for(int i=0;i<prime.size();i++) {
				nn=nn/prime.get(i);
				ans.add(prime.get(i));
				for(int j=0;j<a.size();j++) {
					if(!visited[j]) {
						if(i!=prime.size()-1&&a.get(j)==prime.get(i)*prime.get(i+1)) {
							visited[j]=true;
						}else {
							if(a.get(j)%prime.get(i)==0) {
								ans.add(a.get(j));
								visited[j]=true;
							}
						}
					}
				}
				if(i!=prime.size()-1&&prime.get(i)*prime.get(i+1)!=n) {
					ans.add(prime.get(i)*prime.get(i+1));
				}
			}
			for(int i:ans)pw.print(i+" ");
			pw.println();
			if(prime.size()==0) {
				pw.println(0);
			}else if(prime.size()==2) {
				if(nn!=1) {
					pw.println(0);
				}else {
				pw.println(1);
				}
			}else {
				
				pw.println(0);
			}
		}
		
		pw.close();
	}

	static long Pow(long a, long e, long mod) // O(log e)
	{
		a %= mod;
		long res = 1l;
		while (e > 0) {
			if ((e & 1) == 1)
				res = (res * a) % mod;
			a = (a * a) % mod;
			e >>= 1l;
		}
		return res;
	}
	public static boolean composite(int n, long a, long d, long s) {
		long x = Pow(a, d, n);
		if (x == 1 || x == n - 1)
			return false;
		for (int i = 1; i < s; i++) {
			x = x * x % n;
			if (x == n - 1)
				return false;
		}
		return true;
	}

	public static boolean isprime(int n) {
		if (n < 2)
			return false;

		int r = 0;
		long d = n - 1;
		while ((d & 1) == 0) {
			d >>= 1;
			r++;
		}

		for (int a : new int[] { 2, 3, 5, 7 }) {
			if (n == a)
				return true;
			if (composite(n, a, d, r))
				return false;
		}
		return true;

	}
	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader r) {
			br = new BufferedReader(r);
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public long[] nextlongArray(int n) throws IOException {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public Long[] nextLongArray(int n) throws IOException {
			Long[] a = new Long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public Integer[] nextIntegerArray(int n) throws IOException {
			Integer[] a = new Integer[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

	}

	static class pair implements Comparable<pair> {
		long x;
		long y;

		public pair(long x, long y) {
			this.x = x;
			this.y = y;
		}

		public String toString() {
			return x + " " + y;
		}

		public boolean equals(Object o) {
			if (o instanceof pair) {
				pair p = (pair) o;
				return p.x == x && p.y == y;
			}
			return false;
		}

		public int hashCode() {
			return new Double(x).hashCode() * 31 + new Double(y).hashCode();
		}

		public int compareTo(pair other) {
			if (this.x == other.x) {
				return Long.compare(this.y, other.y);
			}
			return Long.compare(this.x, other.x);
		}
	}

	static class tuble implements Comparable<tuble> {
		int x;
		int y;
		int z;

		public tuble(int x, int y, int z) {
			this.x = x;
			this.y = y;
			this.z = z;
		}

		public String toString() {
			return x + " " + y + " " + z;
		}

		public int compareTo(tuble other) {
			if (this.x == other.x) {
				if (this.y == other.y) {
					return this.z - other.z;
				}
				return this.y - other.y;
			} else {
				return this.x - other.x;
			}
		}
	}

	static long mod = 1000000007;
	static Random rn = new Random();
	static Scanner sc = new Scanner(System.in);
	static PrintWriter pw = new PrintWriter(System.out);
}