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;
long long po(long long a, long long b) {
  if (b == 0) return 1;
  long long ans = 1;
  if (b % 2 == 0) {
    ans = po(a, b / 2) % 1000000007;
    ans = (ans % 1000000007 * ans % 1000000007) % 1000000007;
  } else {
    ans = po(a, (b - 1) / 2) % 1000000007;
    ans = (ans % 1000000007 * ans % 1000000007 * a) % 1000000007;
  }
  return ans % 1000000007;
}
vector<string> tokens;
void separate_string(string line) {
  stringstream check1(line);
  string lav;
  while (getline(check1, lav, '*')) {
    tokens.push_back(lav);
  }
}
vector<long long> divisors;
void get_Divisors(long long n) {
  for (long long i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i) {
        divisors.push_back(n / i);
      } else {
        divisors.push_back(i);
        divisors.push_back(n / i);
      }
    }
  }
}
void solve() {
  long long n, i, j;
  cin >> n;
  get_Divisors(n);
  long long temp = n;
  map<long long, long long> pu;
  set<long long> prim;
  while (temp % 2 == 0) {
    prim.insert(2);
    pu[2]++;
    temp = temp / 2;
  }
  for (i = 3; i <= sqrt(temp); i = i + 2) {
    while (temp % i == 0) {
      prim.insert(i);
      pu[i]++;
      temp = temp / i;
    }
  }
  if (temp > 2) {
    prim.insert(temp);
    pu[temp]++;
  }
  if (prim.size() == 2) {
    auto tt = prim.begin();
    auto xx = prim.end();
    auto zz = prim.end();
    long long pqr = (*tt);
    long long mno = (*(--xx));
    if (pu[pqr] == 1 && pu[mno] == 1) {
      xx = prim.end();
      cout << (*tt) << " ";
      cout << ((*tt) * (*(--xx))) << " ";
      cout << (*(--zz)) << " ";
      cout << endl;
      cout << "1" << endl;
      return;
    }
  }
  vector<long long> ans;
  auto x = prim.begin();
  ans.push_back(*x);
  i = 0;
  if (prim.size() == 2) {
    auto uuu = prim.end();
    --uuu;
    ans.push_back((*x) * (*uuu));
    ans.push_back((*uuu));
  } else {
    for (auto it = prim.begin(); it != prim.end(); it++) {
      i++;
      if (i == 1) {
        continue;
      } else if (i == prim.size()) {
        auto zzz = it;
        ans.push_back((*it) * (*(--zzz)));
        ans.push_back(*it);
        ans.push_back((*it) * (*x));
      } else {
        auto zzz = it;
        ans.push_back((*it) * (*(--zzz)));
        ans.push_back(*it);
      }
    }
  }
  map<long long, long long> make_pair;
  for (i = 0; i < ans.size(); i++) {
    make_pair[ans[i]] = 1;
  }
  make_pair[1] = 1;
  vector<long long> bache;
  for (i = 0; i < divisors.size(); i++) {
    if (make_pair[divisors[i]] == 0) {
      bache.push_back(divisors[i]);
    }
  }
  if (ans.size() == 1) {
    cout << ans[0] << " ";
    for (j = 0; j < bache.size(); j++) {
      if (make_pair[bache[j]] == 0 && bache[j] % ans[0] == 0) {
        cout << bache[j] << " ";
        make_pair[bache[j]] = 1;
      }
    }
    cout << endl;
    cout << "0" << endl;
    return;
  }
  vector<long long> final;
  int ftr = 0;
  for (i = 0; i < ans.size(); i += 1) {
    if (i % 2) {
      continue;
    }
    final.push_back(ans[i]);
    for (j = 0; j < bache.size(); j++) {
      if (make_pair[bache[j]] == 0 && bache[j] % ans[i] == 0) {
        final.push_back(bache[j]);
        make_pair[bache[j]] = 1;
      }
    }
    if (i != ans.size() - 1) final.push_back(ans[i + 1]);
  }
  if (prim.size() == 2) {
    final.push_back(final[1]);
    for (i = 0; i < final.size(); i++) {
      if (i != 1) {
        cout << final[i] << " ";
      }
    }
    cout << endl;
    cout << "0" << endl;
    return;
  }
  for (auto it : final) {
    cout << it << " ";
  }
  cout << endl;
  cout << "0" << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    divisors.clear();
    solve();
  }
}