#include "testlib.h"
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cmath>

using namespace std;

const int MAXC_OUF = 1000000000;

long long labs(long long a) 
{
    return a < 0 ? -a : a;
}

int main(int argc, char * argv[])
{
    registerTestlibCmd(argc, argv);

    int tn = 1;
    while (true) 
    {
        int sx0 = inf.readInt();
        int sy0 = inf.readInt();
        int ex0 = inf.readInt();
        int ey0 = inf.readInt();

        int sx1 = inf.readInt();
        int sy1 = inf.readInt();
        int ex1 = inf.readInt();
        int ey1 = inf.readInt();

        if (sx0 == sx1 && sy0 == sy1) 
        {
            break;
        }

        long long a = ouf.readInt();
        long long b = ouf.readInt();
        long long c = ouf.readInt();

        if (labs(a) > MAXC_OUF || labs(b) > MAXC_OUF || labs(c) > MAXC_OUF)
        {
            quitf(_pe, "Test %d: Some of output numbers exceeds %d", tn, MAXC_OUF);
        }

        long long sv0 = sx0 * a + sy0 * b + c;
        long long ev0 = ex0 * a + ey0 * b + c;
        long long sv1 = sx1 * a + sy1 * b + c;
        long long ev1 = ex1 * a + ey1 * b + c;

        if (sv0 == 0 || ev0 == 0 || (sv0 < 0) != (ev0 < 0))
        {
            quitf(_wa, "Test %d: The front line has common points with first trench", tn);
        }

        if (sv1 == 0 || ev1 == 0 || (sv1 < 0) != (ev1 < 0))
        {
            quitf(_wa, "Test %d: The front line has common points with second trench", tn);
        }

        if ((sv0 < 0) == (sv1 < 0)) 
        {
            quitf(_wa, "Test %d: Both trenches are at the same side of the front line", tn);
        }
        tn++;
    }
    quitf(_ok, "Correct");
}
