#include <bits/stdc++.h>
using namespace std;
const double eps(1e-8);
int t;
long long n;
bool isprime(long long i) {
  if ((i & 1) == 0)
    return false;
  else {
    for (int j = 2; j * j <= i; j++) {
      if (i % j == 0) return false;
    }
    return true;
  }
}
long long finda(long long k) {
  while (!isprime(k + 1)) {
    k++;
  }
  return k + 1;
}
long long findi(long long k) {
  if (k == 2) return 2;
  while (!isprime(k)) {
    k--;
  }
  return k;
}
long long gcd(long long m, long long n) {
  if (m < n) {
    long long temp = m;
    m = n;
    n = temp;
  }
  if (m % n == 0) {
    return n;
  } else {
    return gcd(n, m % n);
  }
}
int main() {
  scanf("%d", &t);
  while (t--) {
    cin >> n;
    long long ansa = finda(n);
    long long ansi = findi(n);
    long long x = ansi * ansa + 2 * (n - ansa - ansi + 1);
    long long y = 2 * ansi * ansa;
    long long hehe = gcd(x, y);
    x /= hehe;
    y /= hehe;
    cout << x << "/" << y << endl;
  }
  return 0;
}
