#include <bits/stdc++.h>
using namespace std;
const int Mod = 1e9 + 7;
inline int FIX(int a) { return (a % Mod + Mod) % Mod; }
int prime(int x) {
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) return 0;
  }
  return 1;
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  int n;
  long long L, R;
  int t;
  cin >> t;
  while (t--) {
    cin >> n;
    for (int i = n + 1;; i++) {
      if (prime(i)) {
        R = i;
        break;
      }
    }
    for (int i = n; i; i--) {
      if (prime(i)) {
        L = i;
        break;
      }
    }
    long long up = (L - 2) * R + 2 * (n + 1 - L);
    long long down = 2ll * L * R;
    printf("%lld/%lld\n", up / gcd(up, down), down / gcd(up, down));
  }
  return 0;
}
