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;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << ' ' << *it << " = " << a;
  err(++it, args...);
}
inline void op() { cout << '\n'; }
template <typename T, typename... Types>
inline void op(T var1, Types... var2) {
  cout << var1 << ' ';
  op(var2...);
}
inline void ip() {}
template <typename T, typename... Types>
inline void ip(T& var1, Types&... var2) {
  cin >> var1;
  ip(var2...);
}
template <typename T, typename U>
inline void min_self(T& x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void max_self(T& x, U y) {
  if (x < y) x = y;
}
template <class T1, class T2>
ostream& operator<<(ostream& out, pair<T1, T2> pair) {
  return out << "(" << pair.first << ", " << pair.second << ")";
}
template <class T>
ostream& operator<<(ostream& out, vector<T> vec) {
  out << "(";
  for (auto& v : vec) out << v << ' ';
  return out << ")";
}
template <class T>
ostream& operator<<(ostream& out, set<T> vec) {
  out << "(";
  for (auto& v : vec) out << v << ", ";
  return out << ")";
}
template <class L, class R>
ostream& operator<<(ostream& out, map<L, R> vec) {
  out << "(";
  for (auto& v : vec) out << "[" << v.first << ", " << v.second << "]";
  return out << ")";
}
template <class A, class B>
istream& operator>>(istream& in, pair<A, B>& a) {
  return in >> a.first >> a.second;
}
template <class A>
istream& operator>>(istream& in, vector<A>& a) {
  for (A& i : a) in >> i;
  return in;
}
template <class Container>
void split(const std::string& str, Container& cont, char delim = ',') {
  stringstream ss(str);
  string token;
  while (std::getline(ss, token, delim)) {
    cont.push_back(token);
  }
}
long long px[4] = {-1, 0, 1, 0};
long long py[4] = {0, -1, 0, 1};
struct edge {
  long long u, v, wt;
  edge(long long a = 0, long long b = 0, long long c = 0) : u(a), v(b), wt(c) {}
  bool operator<(edge const& other) { return wt < other.wt; }
  friend ostream& operator<<(ostream& out, const edge& x) {
    return out << "(" << x.u << ", " << x.v << ", " << x.wt << ")";
  }
};
vector<long long> divisors(long long n) {
  vector<long long> a;
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      a.push_back(i);
      if (i * i != n) a.push_back(n / i);
    }
  }
  a.push_back(n);
  sort(a.begin(), a.end());
  return a;
}
vector<long long> primes(long long n) {
  vector<long long> a;
  if (n % 2 == 0) {
    a.push_back(2);
    while (n % 2 == 0) n >>= 1;
  }
  for (long long i = 3; i * i <= n; i += 2) {
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      a.push_back(i);
    }
  }
  if (n > 1) a.push_back(n);
  return a;
}
void abcd() {
  long long n, res = 0;
  ip(n);
  vector<long long> div = divisors(n);
  vector<long long> pri = primes(n);
  set<long long> s(div.begin(), div.end()), used;
  for (long long i = 1; i <= (long long)pri.size() - 1; i++) {
    used.insert(pri[i] * pri[i - 1]);
  }
  long long lst = pri[0] * pri.back();
  vector<long long> a;
  if (pri.size() == 2) {
    if (pri[0] * pri.back() == n) {
      op(pri[0], pri.back(), n);
      op(1);
    } else {
      cout << pri[0] << ' ' << pri[0] * pri.back() << ' ' << pri.back() << ' ';
      s.erase(pri[0]);
      s.erase(pri.back());
      s.erase(pri[0] * pri.back());
      s.erase(n);
      stack<long long> temp;
      for (long long i : s) {
        if (i % pri.back() == 0) {
          cout << i << ' ';
          temp.push(i);
        }
      }
      while (!temp.empty()) {
        s.erase(temp.top());
        temp.pop();
      }
      cout << n << ' ';
      for (long long i : s) cout << i << ' ';
      cout << '\n';
      op(0);
    }
    return;
  }
  for (long long p : pri) {
    a.push_back(p);
    s.erase(p);
    vector<long long> temp;
    for (long long i : s) {
      if (i % p == 0 && used.find(i) == used.end() && i != lst) {
        temp.push_back(i);
      }
    }
    for (long long i = 0; i <= (long long)temp.size() - 1; i++) {
      a.push_back(temp[i]);
      s.erase(temp[i]);
    }
    if (p != pri.back()) {
      a.push_back(*used.begin());
      s.erase(a.back());
      used.erase(used.begin());
    } else {
      if (s.find(lst) != s.end()) a.push_back(lst);
      break;
    }
  }
  for (long long i = 0; i <= (long long)a.size() - 1; i++) {
    cout << a[i] << ' ';
  }
  cout << '\n';
  op(res);
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  cin >> t;
  while (t--) {
    abcd();
  }
  return 0;
}