#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std; const int maxn = ;
const int L = ;
const int R = ;
int t, n, m, ans;
double total;
struct node
{
int x, y;
int cost;
}pot[maxn];
int fa[maxn];
int px[maxn], py[maxn]; int cal()
{
int i, j, tx, ty, len, pos;
pos = ;
for (i = ; i<n; i++)
{
for (j = i + ; j<n; j++)
{
tx = px[i] - px[j];
ty = py[i] - py[j];
len = tx*tx + ty*ty;
if (len >= L&&len <= R)
{
pot[pos].x = i;
pot[pos].y = j;
pot[pos].cost = len;
pos++;
}
}
}
return pos;
} void init()
{
total = 0.0;
ans = n - ;
for (int i = ; i <= n; i++)
{
fa[i] = i;
}
} bool cmp(node a, node b)
{
return a.cost<b.cost;
} int find(int x)
{
if (x != fa[x])
return fa[x] = find(fa[x]);
return fa[x];
} int join(int x, int y)
{
int flag = ;
if (x != y)
{
ans--;
fa[x] = y;
flag = ;
}
return flag;
} int main()
{
scanf("%d", &t);
while (t--)
{
scanf("%d", &n);
init();
for (int i = ; i<n; i++)
{
scanf("%d %d", &px[i], &py[i]);
}
int len = cal();
if (len<n - )
{
printf("oh!\n");
continue;
}
sort(pot, pot + len, cmp);
for (int i = ; i<len; i++)
{
int fx, fy;
fx = find(pot[i].x);
fy = find(pot[i].y);
if (join(fx, fy) == )
{
total += sqrt(pot[i].cost*1.0);
}
}
if (ans != )
{
printf("oh!\n");
continue;
}
printf("%.1lf\n", total * );
}
return ;
}
05-11 20:45