#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define yes "YES"
#define no "NO"
#define pb push_back
#define si size()
#define inco " "

int main()
{
    ll t;
    cin>>t;
    while(t--)
    {
        vector<ll>miner;
        vector<ll>mine;
        ll n,x,y;
        cin>>n;
        for(ll i=0; i<2*n; i++)
        {
            cin>>x>>y;
            if(x==0)
                miner.pb(abs(y));
            else
                mine.pb(abs(x));
        }
        sort(miner.begin(),miner.end());
        sort(mine.begin(),mine.end());
        double sum=0;
        for(ll i=n-1; i>=0; i--)
            sum+=sqrt((miner[i]*miner[i])+(mine[i]*mine[i]));
        printf("%.17lf\n",sum);
    }

}

