#include <bits/stdc++.h>
using namespace std;
bool isPrime(int x) {
  if (x == 2) return true;
  if (x % 2 == 0 || x < 2) return false;
  for (int i = 3; i * i <= x; i += 2)
    if (x % i == 0) return false;
  return true;
}
long long GCD(long long x, long long y) { return y ? GCD(y, x % y) : x; }
long long LCM(long long x, long long y) { return x * (y / GCD(x, y)); }
struct Fraction {
  long long nom, denom;
  Fraction(long long nom = 0, long long denom = 1) {
    this->nom = nom;
    this->denom = denom;
    this->Simplify();
  }
  void Simplify() {
    long long G = GCD(nom, denom);
    nom /= G;
    denom /= G;
  }
  Fraction operator+(const Fraction& f) {
    Fraction A = *this, B = f;
    A.Simplify();
    B.Simplify();
    long long L = LCM(A.denom, B.denom);
    long long x1 = L / A.denom;
    long long x2 = L / B.denom;
    Fraction Res = Fraction(x1 * A.nom + x2 * B.nom, L);
    Res.Simplify();
    return Res;
  }
  Fraction operator-(const Fraction& f) {
    Fraction Res = *this + Fraction(-f.nom, f.denom);
    Res.Simplify();
    return Res;
  }
  Fraction operator*(const Fraction& f) {
    Fraction A = *this, B = f;
    A.Simplify();
    B.Simplify();
    swap(A.nom, B.nom);
    A.Simplify();
    B.Simplify();
    Fraction Res = Fraction(A.nom * B.nom, A.denom * B.denom);
    Res.Simplify();
    return Res;
  }
  Fraction operator/(const Fraction& f) {
    Fraction A = *this, B = f;
    swap(A.nom, B.denom);
    Fraction Res = A * B;
    Res.Simplify();
    return Res;
  }
  Fraction operator+=(const Fraction& f) { return (*this) = (*this) + f; }
  Fraction operator-=(const Fraction& f) { return (*this) = (*this) - f; }
  Fraction operator*=(const Fraction& f) { return (*this) = (*this) * f; }
  Fraction operator/=(const Fraction& f) { return (*this) = (*this) / f; }
  void Print() { printf("%I64d/%I64d\n", nom, denom); }
};
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int n;
    scanf("%d", &n);
    long long Nxt;
    for (int i = n + 1;; i++)
      if (isPrime(i)) {
        Nxt = i;
        break;
      }
    long long Pre;
    for (int i = n;; i--)
      if (isPrime(i)) {
        Pre = i;
        break;
      }
    long long Counter = n - Pre + 1;
    Fraction Ans;
    Ans += Fraction(1, 2);
    Ans += Fraction(-1, Pre);
    Ans += Fraction(Counter, Nxt * Pre);
    Ans.Print();
  }
  return 0;
}
