#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long i, p[50000], flag[50000], cnt, j;
long long nn, nnn, a, b, r, n;
int main() {
  for (i = 2; i <= 40000; i++) flag[i] = 1;
  for (i = 2; i <= 40000; i++) {
    if (flag[i]) {
      for (j = 2 * i; j <= 40000; j += i) flag[j] = 0;
      p[cnt++] = i;
    }
  }
  int t;
  scanf("%d", &t);
  while (t--) {
    scanf("%I64d", &n);
    nn = n;
    while (1) {
      for (i = 0; i < cnt; i++)
        if (nn % p[i] == 0 && nn > p[i]) break;
      if (i == cnt) break;
      nn--;
    }
    nnn = n + 1;
    while (1) {
      for (i = 0; i < cnt; i++)
        if (nnn % p[i] == 0 && nnn > p[i]) break;
      if (i == cnt) break;
      nnn++;
    }
    a = 1ll * nn * nnn * 2;
    b = 1ll * nn * nnn - 1ll * 2 * nn - 1ll * 2 * nnn + 1ll * 2 * n + 2;
    r = gcd(a, b);
    a /= r;
    b /= r;
    printf("%I64d/%I64d\n", b, a);
  }
  return 0;
}
