#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std; const double eps = 1e-;
const double PI = acos(-1.0);
const double INF = 100000000.000000; struct Point{
int index;
double x,y;
Point(double x=, double y=) : x(x),y(y){ } //构造函数
};
typedef Point Vector; Vector operator + (Vector A , Vector B){return Vector(A.x+B.x,A.y+B.y);}
Vector operator - (Vector A , Vector B){return Vector(A.x-B.x,A.y-B.y);}
Vector operator * (Vector A , double p){return Vector(A.x*p,A.y*p);}
Vector operator / (Vector A , double p){return Vector(A.x/p,A.y/p);} bool operator < (const Point& a,const Point& b){
return a.y < b.y ||( a.y == b.y && a.x < b.x);
} int dcmp(double x){
if(fabs(x) < eps) return ;
else return x < ? - : ;
}
bool operator == (const Point& a, const Point& b){
return dcmp(a.x - b.x) == && dcmp(a.y - b.y) == ;
} ///向量(x,y)的极角用atan2(y,x);
double Dot(Vector A, Vector B){ return A.x*B.x + A.y*B.y; }
double Length(Vector A) { return sqrt(Dot(A,A)); }
double Angle(Vector A, Vector B) { return acos(Dot(A,B) / Length(A) / Length(B)); } double Cross(Vector A, Vector B) { return A.x*B.y - A.y * B.x; } Vector Rotate(Vector A, double rad) { return Vector(A.x*cos(rad)-A.y*sin(rad),A.x*sin(rad)+A.y*cos(rad)); } double Area(Point A,Point B,Point C) { return Cross(B-A,C-A); } Point read_point(){
Point A;
scanf("%d %lf %lf",&A.index,&A.x,&A.y);
return A;
} /*************************************分 割 线*****************************************/ Point P[];
int pos;
bool cmp(Point A,Point B){
double num = Cross(A-P[pos],B-P[pos]);
if(dcmp(num) == ){
return Length(A-P[pos]) < Length(B-P[pos]);
}
else if(dcmp(num) < ) return false;
else return true;
}
int main()
{
//freopen("E:\\acm\\input.txt","r",stdin);
int T;
cin>>T;
int N;
while(T--){
cin>>N;
for(int i=;i<=N;i++){
P[i] = read_point();
if(P[i] < P[]){
swap(P[i],P[]);
}
}
pos = ;
for(int i=;i<=N;i++){
sort(P+i,P+N+,cmp);
pos++;
}
printf("%d",N);
for(int i=;i<=N;i++)
printf(" %d",P[i].index);
printf("\n");
}
}