#include "testlib.h"
#include <bits/stdc++.h>

using namespace std;

struct pt {
    int x, y;
};

int operator*(const pt& a, const pt& b) {
    return a.x * b.y - a.y * b.x;
}

pt operator-(const pt& a, const pt& b) {
    return {a.x - b.x, a.y - b.y};
}

const int n = 6;

int main(int argc, char* argv[]) {
    registerValidation(argc, argv);
    int t = inf.readInt(1, 1000, "t");
    inf.readEoln();
    for (int tc = 1; tc <= t; ++tc) {
        setTestCase(tc);
        vector<pt> arr(6);
        for (int i = 0; i < 6; ++i) {
            int x = inf.readInt(0, 1000, "X");
            inf.readSpace();
            int y = inf.readInt(0, 1000, "Y");
            inf.readEoln();
            arr[i] = {x, y};
        }
        bool hasnonzero = false;
        int sg = 0;
        for (int i = 0; i < n; ++i) {
            int x = (arr[(i + 1) % n] - arr[i]) * (arr[(i + 2) % n] - arr[(i + 1) % n]);
            if (!x) continue;
            hasnonzero = true;
            ensuref(!(x < 0 && sg == 1 || x > 0 && sg == -1), "polygon is not convex");
            sg = (x < 0 ? -1 : 1);
        }
        ensuref(hasnonzero, "polygon is line");
    }
    inf.readEof();
}