#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<queue>
#include<functional>
#include<cstring>
#include<cstdlib>
#include<complex>
using namespace std;
typedef long long ll;
typedef complex < double > Point;
/*
    Point????????????
    Point A????????????X??則?即?...real(A) or A.real()
                   Y??則?即?...imag(A) or A.imag() ??其???????????贈???????????????????????????????????即???

    Point A,B????????????A+B,A-B,(double)k * A???????????????
    ????????????????????蔵???sqrt(norm(A))
    ?????????????????蔵???sqrt(norm(A-B))
    norm(A)???X^2+Y^2?????????
*/
typedef vector < Point > Polygon;
namespace std {
    bool operator < (Point a,Point b) {
        //????????則??則?即??????????????????????"??則??????"?????????
        return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
    }
}
const double EPS = 1e-8;
const double INF = 1e12;



struct Line : Polygon{
    Line(Point p,Point q){ push_back(p);push_back(q); }
};
struct Circle{
    Point p;
    double r;
    Circle(Point a, double s){ p = a;r = s; }
};

double cross(Point p,Point q){
    return imag(conj(p)*q);
}

double dot(Point p,Point q){
    return real(conj(p)*q);
}

int ccw(Point a,Point b,Point c){
    b-=a,c-=a;
    if(cross(b,c)>0)return 1; //???????即???????
    if(cross(b,c)<0)return -1; //????即???????
    if(dot(b,c)<0)return 2; //??卒????????? c - a - b
    if(norm(b)<norm(c))return -2; // ??卒????????? a - b - c
    return 0; // ??卒????????? a - c - b
}

Point normalize(Point P, double l){
    double a = real(P), b = imag(P);
    double y = sqrt(b*b/(a*a+b*b)*l*l);
    double x = (a/b)*y;

    return Point(x,y);
}

double heron(Point A, Point B, Point C){
    double a = sqrt(norm(A-B));
    double b = sqrt(norm(B-C));
    double c = sqrt(norm(C-A));
    double s = (a+b+c)/2;

    return sqrt(s*(s-a)*(s-b)*(s-c));
}
bool intersectLL(Line l, Line m) {
    return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS || // ????????則??????
         abs(cross(l[1]-l[0], m[0]-l[0])) < EPS;   // ????????????
}
bool intersectLS(Line l, Line s) {
    return cross(l[1]-l[0], s[0]-l[0])*       // s[0] ??? l??????
           cross(l[1]-l[0], s[1]-l[0]) < EPS; // s[1] ??? l??????
}
bool intersectLP(Line l, Point p) {
    return abs(cross(l[1]-p, l[0]-p)) < EPS;
}
bool intersectSS(Line s, Line t) {
    return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}
bool intersectSP(Line s, Point p) {
    return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}
//???2?????????????????????????????????????????????,??????????????????????????属
int intersectCC(Circle A, Circle B, Point *p, Point *q){

    Point P,Q;
    if(B.p<A.p)swap(A.p,B.p);
    Point dv = B.p - A.p;//????????????


    double L = sqrt(norm(dv));
    int num;
    //?????蔵???L?????卒???
    if( L==(A.r + B.r) ){
        num = 1;
        //??????1???
        //?????属???????????贈???????????則????????即?????属??????
        dv = normalize(dv,A.r);
        P = Q = Point(real(dv)+real(A.p),imag(dv)+imag(A.p));
    }
    else if( L<(A.r + B.r) && L > fabs(A.r - B.r) ){
        num = 2;
        //??????2???
        /*
        ???????????????Q??????????????????dv??????????????????????????即?????????pt??即??????
        ??????????????卒?則?????則???蔵p0-pt-Q???p1-pt-Q?????則??????
        p0-pt???????????????t??即????????即???????????????????則???蔵???Q-pt??????????????????????????????

        r0*r0 - t*t = r1*r1 - (L-t)*(L-t)
        r0*r0 - t*t = r1*r1 - L*L - t*t + 2*L*t
        t = (r0*r0 - r1*r1 + L*L)/(2*L)

        t?????????p0-Q??????????????即dv??????????????即????則????a????賊???????
        dv?????????????????????+a,-a?????則?即?????賊?????????属????????即??????
        */

        //t????賊???????
        double t = 0.5*( A.r*A.r - B.r*B.r + L*L)/L;

        //p0-Q??????????????即dv????????????????則????
        double a = acos( t/A.r );

        //dv????????????????則????
        double a0 = atan2( imag(dv), real(dv) );

        //??????
        P = Point( real(A.p) + A.r*cos(a0+a), imag(A.p) + A.r*sin(a0+a) );
        Q = Point( real(A.p) + A.r*cos(a0-a), imag(A.p) + A.r*sin(a0-a) );

    }
    else{
        num = 0;
        //????????????
    }

    *p = P;
    *q = Q;

    return num;
}
Point projection(Line l, Point p) {
    double t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
    return l[0] + t * (l[0]-l[1]);
}
Point reflection(Line l, Point p) {
    return p + (projection(l, p) - p) + (projection(l, p) - p);
}
double distanceLP(Line l, Point p) {
    return abs(p - projection(l, p));
}
double distanceLL(Line l, Line m) {
    return intersectLL(l, m) ? 0 : distanceLP(l, m[0]);
}
double distanceLS(Line l, Line s) {
    if (intersectLS(l, s)) return 0;
    return min(distanceLP(l, s[0]), distanceLP(l, s[1]));
}
double distanceSP(Line s, Point p) {
    const Point r = projection(s, p);
    if (intersectSP(s, r)) return abs(r - p);
    return min(abs(s[0] - p), abs(s[1] - p));
}
double distanceSS(Line s, Line t) {
    if (intersectSS(s, t)) return 0;
    return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),
             min(distanceSP(t, s[0]), distanceSP(t, s[1])));
}
Point crosspoint(Line l, Line m) {
    double A = cross(l[1] - l[0], m[1] - m[0]);
    double B = cross(l[1] - l[0], l[1] - m[0]);
    if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
    if (abs(A) < EPS);
    return m[0] + B / A * (m[1] - m[0]);
}

int main(){
    Point P,Q;
    cin>>real(P)>>imag(P)>>real(Q)>>imag(Q);
    int n;
    cin>>n;
    while(n--){
        Point R;
        cin>>real(R)>>imag(R);
        string str;
        int a = ccw(P,Q,R);
        switch(a){
            case 1:
                str = "COUNTER_CLOCKWISE";
            break;
            case -1:
                str = "CLOCKWISE";
            break;
            case 2:
                str = "ONLINE_BACK";
            break;
            case -2:
                str = "ONLINE_FRONT";
            break;
            case 0:
                str = "ON_SEGMENT";
            break;
        }
        cout<<str<<endl;
    }
    return 0;
}

Measured memory_bytes: 1252