#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define CRP(t, x) const t &x
#define OPL(t, x) bool operator<(CRP(t, x)) const
#define FIL(x, v) memset(x, v, sizeof(x))
#define CLR(x) FIL(x, 0)
#define NE1(x) FIL(x, -1)
#define INF(x) FIL(x, 0x3f)
typedef long long ll, i64;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
struct prob
{
    int a, b;
    OPL(prob, rhs) { return a < rhs.a || (a == rhs.a && b > rhs.b); }
};
int main()
{
    int T, n;
    scanf("%d", &T);
    while (T--)
    {
        priority_queue<prob> H;
        ll hi = 0, lo = 1, g, asum = 0;
        scanf("%d", &n);
        for (int i = 0; i < n; i++)
        {
            prob p;
            scanf("%d%d", &p.a, &p.b);
            if (p.a > p.b) swap(p.a, p.b);
            H.push(p);
            asum += p.a;
            if (i & 1 ^ 1)
            {
                p = H.top();
                hi = (asum - p.a) * (p.a + p.b) + p.a * p.b;
                lo = p.a + p.b;
            }
            else
            {
                hi = asum, lo = 1;
            }
            g = gcd(hi, lo);
            hi /= g, lo /= g;
            printf("%lld/%lld\n", hi, lo);
        }
    }
    return 0;
}