#include <bits/stdc++.h>
using namespace std;
int T;
int n;
bool check(int x) {
  int lim = sqrt(x);
  for (int i = 2; i <= lim; ++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; }
int main() {
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    int l = n, r = n + 1;
    while (!check(l)) --l;
    while (!check(r)) ++r;
    long long a = 1, b = 1, c;
    b = 2LL * l * r;
    a = (l - 2) * 1LL * r;
    a += 2 * (n - l + 1);
    c = gcd(a, b);
    printf("%I64d/%I64d\n", a / c, b / c);
  }
  return 0;
}
