#include <stdio.h>
#include <math.h>

typedef struct point{
    double x, y;
}point;

double inclination(point p1, point p2);
double clockwise(point a, point b, point c);
double length(point a, point b);

int main(void)
{
    point a, b, c;
    int n, i;
    double ans;

    scanf("%lf%lf", &a.x, &a.y);

    scanf("%lf%lf", &b.x, &b.y);

    scanf("%d",&n);

    for (i = 0; i < n; i++) {
        scanf("%lf%lf", &c.x, &c.y);
        if (a.x == c.x && a.y == c.y) {
            puts("ON_SEGMENT");
            continue;
        }
        ans = clockwise(a, b, c);
        //printf("%.10lf\n",ans);
        if ((3.1415926534 < ans && ans < 3.1415926536)) {
            puts("ONLINE_BACK");
        } else if (ans < 0) {
            puts("CLOCKWISE");
        } else if (ans > 0) {
            puts("COUNTER_CLOCKWISE");
        } else if (length(a,c) > length(a,b)) {
            puts("ONLINE_FRONT");
        } else {
            puts("ON_SEGMENT");
        }
    }
    return 0;
}

double clockwise(point a, point b, point c) 
{
    //*abを軸としてacの角度を求める
    double rad1, rad2;

    rad1 = fabs(atan2(b.y - a.y, b.x - a.x));
    rad2 = fabs(atan2(c.y - a.y, c.x - a.x));
    //printf("%lf %lf\n",rad1, rad2);

    return rad2 - rad1;
}

double inclination(point p1, point p2)
{
    //*傾き
    if (-0.00000000002 < p2.x - p1.x && p2.x - p1.x < 0.00000000002) {
        return 2100000000.0;
    } else {
        return (p2.y - p1.y) / (p2.x - p1.x);
    }
}

double length(point a, point b)
{
    return sqrt((b.x-a.x)*(b.x-a.x) + (b.y-a.y)*(b.y-a.y));
}