// Author: Christian Lim
// Date: July 23, 2025

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) {
  return (!b) ? a : gcd(b,a%b);
}

int main() {
  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  int t; cin>>t;
  while (t--) {
    int n; cin>>n;
    vector<ll> x(n), y(n);
    for (int i=0; i<n; i++)
      cin>>x[i]>>y[i];
    ll dArea=0, pieceArea=0, best=0;
    for (int i=0; i<n; i++)
      dArea+=x[i]*y[(i+1)%n]-x[(i+1)%n]*y[i];
    dArea=abs(dArea);
    for (int i=0; i<n-1; i++) {
      pieceArea += x[i]*y[i+1]-x[i+1]*y[i];
      if (!i) continue;
      ll update=x[i+1]*y[0]-x[0]*y[i+1];
      ll curPiece=abs(pieceArea+update);
      curPiece=min(curPiece,dArea-curPiece);
      best=max(best,curPiece);
    }
    ll num = best;
    ll den = dArea-best;
    ll div = gcd(num,den);
    cout<<(num/div)<<" "<<(den/div)<<"\n";
  }
  return 0;
}

