#include <iostream>
#include <stdio.h>

#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;

const double EPS = 1e-10;

const int COUNTER_CLOCKWISE = 1;
const int CLOCKWISE = -1;
const int ONLINE_BACK = 2;
const int ONLINE_FRONT = -2;
const int ON_SEGMENT = 0;

double add(double a, double b){
    if(abs(a + b) < EPS * (abs(a) + abs(b)))return 0;
    return a + b;
}

bool equals(double a, double b){
    return fabs(a - b) < EPS;
}

struct Pt {
    double x, y;
    Pt(){}
    Pt(double x, double y):x(x), y(y){}
    Pt operator + (Pt p){return Pt(add(x, p.x), add(y, p.y));}
    Pt operator - (Pt p){return Pt(add(x, -p.x), add(y, -p.y));}
    Pt operator * (double d){return Pt(x * d, y * d);}
    Pt operator / (double d){return Pt(x / d, y / d);}
    bool operator < (const Pt &p)const {return x != p.x ? x < p.x : y < p.y;}
    bool operator == (const Pt &p)const {return equals(x, p.x)&&equals(y, p.y);}
    double dot(Pt p){return add(x * p.x, y * p.y);}
    double det(Pt p){return add(x * p.y, -y * p.x);}
    double norm(){return x*x+y*y;}
    double abs(){return sqrt(norm());}
    bool isOrthogonal(Pt v){return equals(dot(v), 0.0);}
    bool isParallel(Pt v){return equals(det(v), 0.0);}
    double distance(Pt p){return Pt(add(x, -p.x), add(y, -p.y)).abs();}
    int ccw(Pt p1, Pt p2){
        Pt v1 = p1 - Pt(x, y);
        Pt v2 = p2 - Pt(x, y);
        if(v1.det(v2) > EPS) return COUNTER_CLOCKWISE;
        if(v1.det(v2) < -EPS)return CLOCKWISE;
        if(v1.dot(v2) < -EPS)return ONLINE_BACK;
        if(v1.norm() < v2.norm())return ONLINE_FRONT;
        return ON_SEGMENT;
    }
};

struct Cr{
    Pt p;
    double r;
    Cr(){}
    Cr(double x, double y, double r):p(Pt(x, y)), r(r){}
    Cr(Pt p, double r):p(p), r(r){}
};

struct Pl{
    vector<Pt>pts;
};

struct Ln {
    Pt p1, p2;
    Ln(){}
    Ln(double x1, double y1, double x2, double y2):p1(Pt(x1, y1)), p2(Pt(x2, y2)){}
    Ln(Pt p1, Pt p2):p1(p1), p2(p2){}
    Pt project(Pt p){
        Pt base = p2 - p1;
        double r = base.dot(p - p1) / base.norm();
        return p1 + base * r;
    }
    Pt reflect(Pt p){
        return p + Pt(project(p) - p) * 2.0;
    }
    bool isOrthogonal(Ln line){
        Pt v1 = p2 - p1;
        Pt v2 = line.p2 - line.p1;
        return v1.isOrthogonal(v2);
    }
    bool isParallel(Ln line){
        Pt v1 = p2 - p1;
        Pt v2 = line.p2 - line.p1;
        return v1.isParallel(v2);
    }
    bool intersect(Ln seg){
        Pt p3 = seg.p1;
        Pt p4 = seg.p2;
        return ( p1.ccw(p2, p3) * p1.ccw(p2, p4) <= 0 && p3.ccw(p4, p1) * p3.ccw(p4, p2) <= 0);
    }
    double distanceLP(Pt p){
        return abs(Pt(p2-p1).det(p-p1)) / Pt(p2 - p1).abs();
    }
    double distanceSP(Pt p){
        if(Pt(p2-p1).dot(p-p1) < 0.0)return Pt(p-p1).abs();
        if(Pt(p2-p1).dot(p-p2) < 0.0)return Pt(p-p2).abs();
        return distanceLP(p);
    }
    double distance(Ln sg){
        if(intersect(sg))return 0.0;
        return min(min(distanceSP(sg.p1), distanceSP(sg.p2)), min(sg.distanceSP(p1), sg.distanceSP(p2)));
    }
    Pt crossPt(Ln line){
        double txa = p2.x - p1.x;
        double tya = p2.y - p1.y;
        double txb = line.p2.x - line.p1.x;
        double tyb = line.p2.y - line.p1.y;
        double t = (txb * (line.p1.y - p1.y) - tyb * (line.p1.x - p1.x)) / (txb * tya - txa * tyb);
        return p1 + (p2 - p1) * t;
    }
};


signed main(){
    double x0, y0, x1, y1, x2, y2;
    scanf("%lf %lf %lf %lf", &x0, &y0, &x1, &y1);
    Pt p(x0, y0), p1(x1, y1);
    int n;
    scanf("%d", &n);
    for(int i=0;i<n;i++){
        scanf("%lf %lf", &x2, &y2);
        Pt p2(x2, y2);
        int ccw = p.ccw(p1, p2);
        if(ccw==1)printf("COUNTER_CLOCKWISE\n");
        if(ccw==-1)printf("CLOCKWISE\n");
        if(ccw==2)printf("ONLINE_BACK\n");
        if(ccw==-2)printf("ONLINE_FRONT\n");
        if(ccw==0)printf("ON_SEGMENT\n");
    }
    return 0;
}



Measured memory_bytes: 3240