#include <bits/stdc++.h>
using namespace std;
bool prime(const int n) {
  for (auto i = 2; i <= n / i; i++) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
int v(int n) {
  while (1) {
    if (prime(n)) {
      return n;
    }
    n--;
  }
}
int u(int n) {
  while (1) {
    n++;
    if (prime(n)) {
      return n;
    }
  }
  return 0;
}
int gcd(long long a, long long b) {
  while (a != 0) {
    auto temp = a;
    a = b % a;
    b = temp;
  }
  return b;
}
int main() {
  ios_base::sync_with_stdio(false);
  short t;
  cin >> t;
  for (int n; cin >> n;) {
    auto numerator = 2 * (n - v(n) - u(n) + 1) + (long long)u(n) * v(n);
    auto denominator = 2LL * u(n) * v(n);
    auto r = gcd(numerator, denominator);
    cout << numerator / r << '/' << denominator / r << endl;
  }
  return 0;
}
