#include <bits/stdc++.h>
using namespace std;
bool is_prime(long long x) {
  long long s = sqrt(x);
  for (long long i = 2; i <= s; i++)
    if (x % i == 0) return false;
  return true;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
signed main() {
  long long t, n;
  scanf("%lld", &t);
  while (t--) {
    cin >> n;
    if (n == 1) {
      cout << 0 << endl;
      continue;
    }
    long long v = n, u = n + 1;
    while (!is_prime(v)) v--;
    while (!is_prime(u)) u++;
    long long a = v * u - 2 * u + 2 * n - 2 * v + 2, b = 2 * u * v,
              GCD = gcd(a, b);
    cout << a / GCD << "/" << b / GCD << endl;
  }
}
