#include<iostream>
using namespace std;
#include<cstdio>
#include<complex>

typedef double type_n;
typedef complex<type_n> point;

int ccw(const point &a, const point &c, const point &z)
{
    point w;
    w = conj(c) * (z - a);
    if(w.imag() > 0){ return 1; }
    if(w.imag() < 0){ return -1; }
    if(w.real() < 0){ return 2; }
    if(w.real() > norm(c)){ return -2; }
    return 0;
}

int main()
{
    point a, b, c, z;
    int i, q, crit;
    type_n a1, a2, b1, b2, z1, z2;
    scanf("%lf %lf %lf %lf", &a1, &a2, &b1, &b2);
    a.real(a1), a.imag(a2), b.real(b1), b.imag(b2);
    c = b - a;

    scanf("%d", &q);
    for(i = 0; i < q; i++){
        scanf("%lf %lf", &z1, &z2);
        z.real(z1), z.imag(z2);
        crit = ccw(a, c, z);
        switch(crit){
            case 1:
                printf("COUNTER_CLOCKWISE\n");
                break;
            case -1:
                printf("CLOCKWISE\n");
                break;
            case 2:
                printf("ONLINE_BACK\n");
                break;
            case -2:
                printf("ONLINE_FRONT\n");
                break;
            default:
                printf("ON_SEGMENT\n");
                break;
        }
    }
    return 0;
}