#include
double direction( double x1,double y1,double x2,double y2,double x0,double y0 )
{
double a,b,c,d;
a=y2-y1;
b=x1-x2;
c=x2*y1-x1*y2;
d=a*x0+b*y0+c;
return d;
}
int main()
{
int t;
double x1,y1,x2,y2,x3,y3,x4,y4,x0,y0;
double a1,a2,a3,a4;
scanf("%d",&t);
while(t--)
{
scanf("%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4,&x0,&y0);
a1=direction( x1,y1,x2,y2,x0,y0 );
a2=direction( x2,y2,x3,y3,x0,y0 );
a3=direction( x3,y3,x4,y4,x0,y0 );
a4=direction( x4,y4,x1,y1,x0,y0);
if(a1<0&&a2<0&&a3<0&&a4<0 ||a1>0&&a2>0&&a3>0&&a4>0 )
printf("T\n");
else
printf("F\n");
}
return 0;
}