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 CPP):

Solution:
#include <bits/stdc++.h>
int num, tot, hd, top = 0;
std::vector<int> vec;
int p[35], cnt[35], st[100005];
inline int read() {
  register int x = 0, f = 1;
  register char s = getchar();
  while (s > '9' || s < '0') {
    if (s == '-') f = -1;
    s = getchar();
  }
  while (s >= '0' && s <= '9') {
    x = x * 10 + s - '0';
    s = getchar();
  }
  return x * f;
}
inline void DivideByPrime(int n) {
  num = 0;
  for (register int i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      p[++num] = i;
      cnt[num] = 0;
      while (n % i == 0) {
        ++cnt[num];
        n /= i;
      }
    }
  }
  if (n > 1) {
    p[++num] = n;
    cnt[num] = 1;
  }
}
int main() {
  int T = read();
  while (T--) {
    int n = read();
    DivideByPrime(n);
    if (num == 2 && cnt[1] == 1 && cnt[2] == 1) {
      printf("%d %d %d\n", n, p[1], p[2]);
      printf("1\n");
    } else {
      vec.clear();
      for (register int i = num; i >= 1; --i) {
        for (register int j = 0; j < vec.size(); ++j) {
          int cur = vec[j];
          for (register int k = 1, x = p[i]; k <= cnt[i]; ++k, x *= p[i]) {
            st[++top] = cur * x;
          }
        }
        int pos = (vec.size() >= 1 ? vec.size() : 0);
        for (register int k = 1, x = p[i]; k <= cnt[i]; ++k, x *= p[i])
          vec.push_back(x);
        while (top) {
          vec.push_back(st[top--]);
        }
        for (register int j = pos; j < vec.size(); ++j) {
          if ((vec[j] % p[i] == 0 &&
               (vec[j] / p[i] == p[i - 1] || vec[j] / p[i] == p[i + 1])) ||
              vec[j] == n)
            continue;
          printf("%d ", vec[j]);
        }
        if (i != 1) printf("%d ", p[i] * p[i - 1]);
      }
      printf("%d\n0\n", n);
    }
  }
  return 0;
}