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 prima[500005];
long long cek[500005];
long long isi[500005];
void sieve(long long a) {
  for (long long i = 2; i * i <= a; i++) {
    if (cek[i] == 0) {
      for (long long j = i * i; j <= a; j += i) {
        cek[j] = 1;
      }
    }
  }
  long long idx = 0;
  for (long long i = 2; i <= a; i++) {
    if (cek[i] == 0) {
      isi[idx] = i;
      idx++;
    }
  }
}
vector<long long> faktor, nebeng;
map<long long, long long> tandai;
int main() {
  long long tc, panjang, i, j, tampung, salah, idx, idx1, angka, lala, k;
  scanf("%lld", &tc);
  getchar();
  sieve(50000);
  for (i = 0; i < tc; i++) {
    scanf("%lld", &angka);
    getchar();
    tampung = sqrt(angka);
    idx1 = 0;
    lala = angka;
    while (faktor.size() != 0) {
      faktor.pop_back();
    }
    for (j = 2; j <= tampung; j++) {
      if ((angka % j) == 0) {
        if ((angka / j) != j) {
          nebeng.push_back(angka / j);
        }
        faktor.push_back(j);
      }
    }
    while (nebeng.size() != 0) {
      faktor.push_back(nebeng[nebeng.size() - 1]);
      nebeng.pop_back();
    }
    faktor.push_back(angka);
    for (j = 0; isi[j] * isi[j] <= angka; j++) {
      if (angka % isi[j] == 0) {
        prima[idx1] = isi[j];
        idx1++;
        while (angka % isi[j] == 0) {
          angka = angka / isi[j];
        }
      }
    }
    if (angka != 1) {
      prima[idx1] = angka;
      idx1++;
    }
    if (faktor.size() == 3 && idx1 == 2) {
      printf("%lld %lld %lld\n", faktor[0], faktor[1], faktor[2]);
      printf("1\n");
      while (faktor.size() != 0) {
        faktor.pop_back();
      }
    } else if (idx1 == 2) {
      for (j = 0; j < faktor.size(); j++) {
        if (faktor[j] == prima[0] || faktor[j] == prima[1] ||
            faktor[j] == lala || faktor[j] == (prima[0] * prima[1])) {
          faktor.erase(faktor.begin() + j);
          j--;
        } else {
          if (faktor[j] % prima[0] == 0) {
            printf("%lld ", faktor[j]);
            faktor.erase(faktor.begin() + j);
            j--;
          }
        }
      }
      printf("%lld %lld %lld ", prima[0], prima[0] * prima[1], prima[1]);
      for (j = 0; j < faktor.size(); j++) {
        if (faktor[j] == prima[0] || faktor[j] == prima[1] ||
            faktor[j] == lala || faktor[j] == (prima[0] * prima[1])) {
          faktor.erase(faktor.begin() + j);
          j--;
        } else {
          if (faktor[j] % prima[1] == 0) {
            printf("%lld ", faktor[k]);
            faktor.erase(faktor.begin() + j);
            j--;
          }
        }
      }
      printf("%lld\n", lala);
      printf("0\n");
    } else if (idx1 == 1) {
      long long salah = 0;
      for (j = 0; j < faktor.size(); j++) {
        if (salah == 1) {
          cout << " ";
        }
        printf("%lld", faktor[j]);
        salah = 1;
        faktor.erase(faktor.begin() + j);
        j--;
      }
      cout << endl;
      printf("0\n");
    } else {
      for (j = 0; j < idx1; j++) {
        if (j == 0) {
          printf("%lld", prima[j]);
        } else {
          printf(" %lld", prima[j]);
        }
        long long lala1, lala2;
        if (j == 0) {
          lala1 = prima[j] * prima[j + 1];
          lala2 = prima[j] * prima[idx1 - 1];
        } else {
          lala1 = prima[j] * prima[(j + 1) % idx1];
          lala2 = 0;
        }
        for (long long k = 0; k < faktor.size(); k++) {
          if (faktor[k] % prima[j] == 0 && faktor[k] != lala1 &&
              faktor[k] != lala2 && faktor[k] != prima[j]) {
            printf(" %lld", faktor[k]);
            faktor.erase(faktor.begin() + k);
            k--;
          }
          if (faktor[k] == lala1 || faktor[k] == lala2 ||
              faktor[k] == prima[j]) {
            faktor.erase(faktor.begin() + k);
            k--;
          }
        }
        printf(" %lld", prima[j] * prima[(j + 1) % idx1]);
      }
      printf("\n0\n");
    }
    while (faktor.size() != 0) {
      faktor.pop_back();
    }
  }
  return 0;
}