#include <bits/stdc++.h>
using namespace std;
long long i, j, n, T, le, ri, u, d;
bool isprime(long long x) {
  for (long long i = 2; i * i <= x; i++)
    if (x % i == 0) return false;
  return true;
}
void pl(long long &u, long long &d, long long x, long long y) {
  long long uu = u;
  long long dd = d;
  u = uu * y + dd * x;
  d = dd * y;
}
long long gcd(long long x, long long y) {
  if (y == 0)
    return x;
  else
    return gcd(y, x % y);
}
void sim(long long &u, long long &d) {
  long long q = gcd(u, d);
  u = u / q;
  d = d / q;
}
int main() {
  cin >> T;
  while (T--) {
    cin >> n;
    le = n;
    while (!isprime(le)) le--;
    ri = n + 1;
    while (!isprime(ri)) ri++;
    d = 2 * le * ri;
    u = le * ri - 2 * ri + 2 * n - 2 * le + 2;
    sim(u, d);
    cout << u << "/" << d << endl;
  }
}
