#include <bits/stdc++.h>
using namespace std;
int prime(long long n, vector<int> p) {
  int i, u;
  u = sqrt(n) + 2;
  for (i = 0; p[i] < n && p[i] < u; i++) {
    if (n % p[i] == 0) {
      return 0;
    }
  }
  return 1;
}
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return b;
  } else {
    gcd(b, a % b);
  }
}
int main() {
  vector<int> a(40000);
  vector<int> p;
  int i, j, n;
  for (i = 2; i < 40000; i++) {
    a[i] = 1;
  }
  for (i = 2; i < 40000; i++) {
    if (a[i] == 1) {
      p.push_back(i);
      for (j = i * i; j < 40000;) {
        a[j] = 0;
        j = j + i;
      }
    }
  }
  long long t, pi, pj, u;
  long long num, den, g;
  cin >> t;
  for (j = 0; j < t; j++) {
    cin >> n;
    for (pi = n;; pi--) {
      if (prime(pi, p) == 1) {
        break;
      }
    }
    for (pj = n + 1;; pj++) {
      if (prime(pj, p) == 1) {
        break;
      }
    }
    num = (pi * pj) - ((pi + pj - n - 1) * 2);
    den = (pi * pj) * 2;
    g = gcd(den, num);
    num = num / g;
    den = den / g;
    cout << num << "/" << den << endl;
  }
  return 0;
}
