#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <cmath>
#include <queue>
#define eps 1e-7
#define M 52
#define N 100005
#define SZ 200000002
using namespace std;
typedef long long ll;
const int inf = 1000000000;
ll mod = 1000000007LL;
ll mod2 = 998244353LL;
int t, n;
vector<int> v1, v2;
int main() {
	cin>>t;
	for (int cas = 1; cas <= t; ++cas) {
		scanf("%d", &n);
		v1.clear();
		v2.clear();
		for (int i = 1; i <= 2*n; ++i) {
			int x,y;
			scanf("%d%d", &x, &y);
			if (x == 0) v1.push_back(abs(y));
			else v2.push_back(abs(x));
		}
		sort(v1.begin(), v1.end());
		sort(v2.begin(), v2.end());
		double ans = 0.0;
		for (int i = 0; i < v1.size(); ++i) {
		//	cout<<"i="<<i<<" "<<v1[i]*v1[i]<<" "<<v2[i]*v2[i]<<endl;
			double res = sqrt((double)v1[i]*(double)v1[i] + (double)v2[i]*(double)v2[i]);
			ans = (ans + res);
		}
		printf("%.10lf\n", ans);
	}
  return 0;
}
