#include <bits/stdc++.h>
using namespace std;
int prime[500100], vis[500100], cnt;
bool check(int l, int x) {
  for (int i = 1; i <= x; i++)
    if (l % prime[i] == 0 && l != prime[i]) return 0;
  return 1;
}
int main() {
  int i, j, t, n;
  long long p, q;
  vis[0] = vis[1] = 1;
  for (i = 2; i <= 500000; i++)
    if (!vis[i]) {
      prime[++cnt] = i;
      for (j = i + i; j <= 500000; j += i) vis[j] = 1;
    }
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    int l, r;
    int x = *lower_bound(prime + 1, prime + 1 + cnt, (int)sqrt(n));
    for (l = n; check(l, x) == 0; l--)
      ;
    x = *upper_bound(prime + 1, prime + 1 + cnt, (int)sqrt(n));
    for (r = n + 1; check(r, x + 1) == 0; r++)
      ;
    if (check(n + 1, x)) {
      printf("%d/%d\n", r - 2, 2 * r);
      continue;
    }
    p = 2LL * (n - l + 1) + (1LL * l - 2) * r;
    q = 2LL * l * r;
    printf("%I64d/%I64d\n", p, q);
  }
}
