#ifdef MYDEBUG
#include "pch.h"
#else
#include <bits/stdc++.h>
#endif
using namespace std;
typedef long long intl;
typedef vector<intl> vi;
typedef pair<intl, intl> pii;

#define println(arg) cout << arg << endl
#define print(arg) cout << arg
#define endln cout << endl
#define inputArr(arg) for (auto& e : arg) cin >> e;
#define printArr(arg) for (auto& e : arg) print(e << ' '); endln
#define all(x) (x).begin(),(x).end()

int main() 
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	unsigned int t = 1;
	cin >> t;  /*LOOP*/
	void code();
	while (t--)	code();
}

constexpr intl mod = 1e9 + 7;
constexpr intl maxn = 1e6 + 1;

void code()
{
	intl n;
	cin >> n;
	vi mr, mn;
	intl f, s;
	for (size_t i = 0; i < n * 2; i++)
	{
		cin >> f >> s;
		if (f)
			mr.push_back(abs(f));
		else
			mn.push_back(abs(s));
	}
	sort(all(mr));
	sort(all(mn));

	double ans = 0;
	for (size_t i = 0; i < n; i++)
	{
		double s1 = mn[i] * mn[i];
		double s2 = mr[i] * mr[i];
		ans += sqrt(s1 + s2);
	}

	printf("%0.15f\n", ans);
}