#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int maxn = 1e5;
const int INF = 0x7fffffff;
const int mod = 1e9 + 7;
const double eps = 1e-7;
inline int read_int() {
  char c;
  int ret = 0, sgn = 1;
  do {
    c = getchar();
  } while ((c < '0' || c > '9') && c != '-');
  if (c == '-')
    sgn = -1;
  else
    ret = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
  return sgn * ret;
}
inline long long read_ll() {
  char c;
  long long ret = 0, sgn = 1;
  do {
    c = getchar();
  } while ((c < '0' || c > '9') && c != '-');
  if (c == '-')
    sgn = -1;
  else
    ret = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') ret = ret * 10 + (c - '0');
  return sgn * ret;
}
bool is_prime(long long x) {
  for (long long i = 2; i * i <= x; ++i)
    if (x % i == 0) return false;
  return x != 1;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long n;
int t;
int main() {
  t = read_int();
  while (t--) {
    n = read_int();
    long long v = n + 1, u = n;
    while (!is_prime(v)) ++v;
    while (!is_prime(u)) --u;
    long long x = u * v + 2 * (n - v - u + 1), y = 2 * u * v;
    long long d = gcd(x, y);
    x /= d, y /= d;
    cout << x << "/" << y << endl;
  }
  return 0;
}
