#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

struct Point{
    int x;
    int y;
};

Point beg, end, lu, ru, ll, rl;

double direction(Point p1, Point p2, Point p3){//p3p1->p2
    return (p3.x - p1.x) * (p2.y - p1.y) - (p2.x - p1.x) * (p3.y - p1.y);
}

bool online(Point p1, Point p2, Point p3){
    return (p3.x >= min(p1.x, p2.x) && p3.x <= max(p1.x, p2.x) && p3.y >= min(p1.y, p2.y) && p3.y <= max(p1.y, p2.y));
}

bool intersect(Point p1, Point p2, Point p3, Point p4){//p1-p2  p3-p4
    double d1 = direction(p3, p4, p1);
    double d2 = direction(p3, p4, p2);
    double d3 = direction(p1, p2, p3);
    double d4 = direction(p1, p2, p4);
    if (d1 * d2 < 0 && d3 * d4 < 0) return true;
    else if (d1 == 0 && online(p3, p4, p1)) return true;
    else if (d2 == 0 && online(p3, p4, p2)) return true;
    else if (d3 == 0 && online(p1, p2, p3)) return true;
    else if (d4 == 0 && online(p1, p2, p4)) return true;
    return false;
}

int main(){
    int n, t;
    cin >> t;
    int tmp;
    int x1, y1, x2, y2;
    while(t --){
        scanf("%d %d %d %d", &beg.x, &beg.y, &end.x, &end.y);
        scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
        if(x1 > x2){
            tmp = x1;
            x1 = x2;
            x2 = tmp;
        }
        if(y1 < y2){
            tmp = y1;
            y1 = y2;
            y2 = tmp;
        }
        lu.x = x1;
        lu.y = y1;
        ru.x = x2;
        ru.y = y1;
        ll.x = x1;
        ll.y = y2;
        rl.x = x2;
        rl.y = y2;
        bool flag = false;
        if(intersect(lu, ru, beg, end))
            flag = true;
        else if(intersect(ll, rl, beg, end))
            flag = true;
        else if(intersect(lu, ll, beg, end))
            flag = true;
        else if(intersect(ru, rl, beg, end))
            flag = true;
        else if(beg.x >= x1 && beg.x <= x2 && beg.y <= y1 && beg.y >= y2 && end.x >= x1 && end.x <= x2 && end.y <= y1 && end.y >= y2)
            flag = true;
        if(flag)
            printf("T\n");
        else
            printf("F\n");
    }
    return 0;
}