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>
using namespace std;
template <typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int te;
  cin >> te;
  while (te--) {
    long long n;
    cin >> n;
    long long x = n;
    vector<pair<int, long long>> div;
    for (long long i = 2; i * i <= x; i++) {
      if (x % i == 0) {
        int cnt = 0;
        while (x % i == 0) {
          cnt++;
          x /= i;
        }
        div.emplace_back(cnt, i);
      }
    }
    if (x > 1) {
      div.emplace_back(1, x);
    }
    sort(div.rbegin(), div.rend());
    assert(!div.empty());
    if (((int)(div).size()) == 1) {
      long long p = 1;
      for (int i = (0); i < (div[0].first); i++) {
        p *= div[0].second;
        cout << p << ' ';
      }
      cout << '\n' << 0 << '\n';
    } else if (((int)(div).size()) == 2) {
      if (div[0].first == 1) {
        long long p = div[0].second, q = div[1].second;
        cout << p << ' ' << p * q << ' ' << q << '\n' << 1 << '\n';
      } else {
        long long p = div[0].second, q = div[1].second;
        int m = div[0].first, l = div[1].first;
        long long pp = 1;
        vector<long long> v1, v2;
        for (int i = (0); i < (m + 1); i++) {
          long long qq = 1;
          for (int j = (0); j < (l + 1); j++) {
            if (j != 1 || (i != 1 && i != 2)) {
              if (i > 0) {
                v1.push_back(pp * qq);
              } else if (j > 0) {
                v2.push_back(pp * qq);
              }
            }
            qq *= q;
          }
          pp *= p;
        }
        cout << p * q << ' ';
        for (long long x : v1) cout << x << ' ';
        cout << p * p * q << ' ';
        for (long long x : v2) cout << x << ' ';
        cout << '\n' << 0 << '\n';
      }
    } else {
      int k = ((int)(div).size());
      vector<vector<long long>> ve(k);
      vector<int> cnt(k, 0);
      long long num = 1;
      vector<long long> prods(k, 1);
      set<long long> se;
      se.insert(1);
      for (int i = (0); i < (k); i++) {
        int j = (i + 1) % k;
        se.insert(div[i].second * div[j].second);
      }
      while (true) {
        int i = 0;
        while (i < k && cnt[i] == div[i].first) {
          num /= prods[i];
          prods[i] = 1;
          cnt[i] = 0;
          i++;
        }
        if (i == k) break;
        cnt[i]++;
        prods[i] *= div[i].second;
        num *= div[i].second;
        if (se.count(num) == 0) {
          ve[i].push_back(num);
        }
      }
      for (int i = (0); i < (k); i++) {
        int j = (i + 1) % k;
        for (long long x : ve[i]) cout << x << ' ';
        cout << div[i].second * div[j].second << ' ';
      }
      cout << '\n' << 0 << '\n';
    }
  }
}