// Devarshi
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;
template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }
const int maxn=1000001;
bool cw(pair<int,pair<int,int> > a,pair<int,pair<int,int> > b,pair<int,pair<int,int> > c){
return a.se.fi*(b.se.se-c.se.se)+b.se.fi*(c.se.se-a.se.se)+c.se.fi*(a.se.se-b.se.se) < 0;
}
bool ccw(pair<int,pair<int,int> > a,pair<int,pair<int,int> > b,pair<int,pair<int,int> > c){
return a.se.fi*(b.se.se-c.se.se)+b.se.fi*(c.se.se-a.se.se)+c.se.fi*(a.se.se-b.se.se) > 0;
}
bool cmp(pair<int,pair<int,int> > a,pair<int,pair<int,int> > b){
if(a.se.se==b.se.se && a.se.fi!=b.se.fi) return a.se.fi<b.se.fi;
if(a.se.fi==b.se.fi) return a.fi<b.fi;
return a.se.se<b.se.se;
}
ld dist(pair<int,pair<ld,ld> > a,pair<int,pair<ld,ld> > b){
ld x=a.se.fi-b.se.fi;
x*=x;
ld y=b.se.se-a.se.se;
y*=y;
return sqrt(x+y);
}
int main(){
sync
#ifndef ONLINE_JUDGE
// for getting input from input.txt
freopen("input.txt", "r", stdin);
// for writing output to output.txt
freopen("output.txt", "w", stdout);
#endif
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<pair<int,pair<int,int> > > pts(n);
map< pair<int,int> ,int > m;
forn(i,n) {
pts[i].fi = 1;
cin>>pts[i].se.fi;
cin>>pts[i].se.se;
if(m.find(mp(pts[i].se.fi,pts[i].se.se))==m.end()){
m[mp(pts[i].se.fi,pts[i].se.se)]=i+1;
}
}
sort(all(pts),cmp);
pair<int,pair<int,int> > a,b;
a.fi=pts[0].fi;
a.se.se=pts[0].se.se;
a.se.fi=pts[0].se.fi;
b.fi=pts[n-1].fi;
b.se.se=pts[n-1].se.se;
b.se.fi=pts[n-1].se.fi;
vector<pair<int,pair<int,int> > > up,down;
up.pb(a);
down.pb(a);
fore(i,1,n-1){
if(i==n-1||cw(a,pts[i],b)){
while(up.size()>=2 && !cw(up[up.size()-2],up[up.size()-1],pts[i])){
up.pop_back();
}
up.pb(pts[i]);
}
if(i==n-1||ccw(a,pts[i],b)){
while(down.size()>=2 && !ccw(down[down.size()-2],down[down.size()-1],pts[i])){
down.pop_back();
}
down.pb(pts[i]);
}
}
reverse(all(up));
vector<pair<int,pair<int,int> > > ans;
ld peri = 0;
fore(i,1,down.size()-1){
peri += dist(down[i],down[i-1]);
}
if(up.size()>2){
fore(i,1,up.size()-1){
peri += dist(up[i],up[i-1]);
}
}
cout<<fixed<<setprecision(2);
cout<<peri<<endl;
for(auto it:down){
cout<<m[mp(it.se.fi,it.se.se)]<<" ";
}
fore(i,1,up.size()-2){
cout<<m[mp(up[i].se.fi,up[i].se.se)]<<" ";
}
cout<<endl<<endl;
}
return 0;
}
Ly8gRGV2YXJzaGkKCiNpbmNsdWRlPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojZGVmaW5lIG1wIG1ha2VfcGFpcgojZGVmaW5lIG10IG1ha2VfdHVwbGUKI2Rl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