#include <stdio.h>
#include <math.h>
#include <iostream>
using namespace std;

#define EPS (1e-10)
#define equals(a, b) (fabs(a - b) < EPS)

class Point{
public:
    double x, y;

    Point(double x_ = 0, double y_ = 0){
        x = x_;
        y = y_;
    }

    Point operator+ (Point p){
        return Point(x + p.x, y + p.y);
    };

    Point operator- (Point p){
        return Point(x - p.x, y - p.y);
    };

    Point operator* (double k){
        return Point(x * k, y * k);
    }

    Point operator/ (double k){
        return Point(x / k, y / k);
    }

    double norm(){
        return x * x + y * y;
    }

    double abs(){
        return sqrt(norm());
    }

    bool operator == (const Point &p) const{
        return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
    }
};

typedef Point Vector;

double dot(Vector a, Vector b){
    return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b){
    return a.x * b.y - a.y * b.x;
}

bool isParallel(Vector a, Vector b){
    return equals(cross(a, b), 0.0);
}

bool isOrthogonal(Vector a, Vector b){
    return equals(dot(a, b), 0.0);
}
;
double getCos(Vector a, Vector b){
    return dot(a, b) / (a.abs() * b.abs());
}

double dist(Point p1, Point p2){
    return sqrt(pow((p1.x - p2.x), 2) + pow((p1.y - p2.y), 2));
}

Point projection(Point p1, Point p2, Point p0){
    if(p1 == p0){
        return p0;
    }
    if(p2 == p0){
        return p0;
    }
    return p1 + (p2 - p1) / (p2 - p1).abs() * (p0 - p1).abs() * getCos(p2 - p1, p0 - p1);
}

Point reflection(Point p1, Point p2, Point p0){
    Point p = projection(p1, p2, p0);
    return p0 + (p - p0) * 2;
}

double getDistanceSP(Point p1, Point p2, Point p0){
    if(dot(p2 - p1, p0 - p1) < 0.0) return (p0 - p1).abs();
    if(dot(p1 - p2, p0 - p2) < 0.0) return (p0 - p2).abs();
    return (projection(p1, p2, p0) -  p0).abs();
}

string counterClockwise(Point p0, Point p1, Point p2){
    Vector v1 = p1 - p0;
    Vector v2 = p2 - p0;
    if(cross(v1, v2) > EPS) return string("COUNTER_CLOCKWISE");
    if(cross(v1, v2) < -EPS) return string("CLOCKWISE");
    if(dot(v1, v2) < -EPS) return string("ONLINE_BACK");
    if(v1.norm() < v2.norm()) return string("ONLINE_FRONT");

    return string("ON_SEGMENT");
}

bool intersect(Point p0, Point p1, Point p2, Point p3){
    return true;
}

double getDistance(Point p0, Point p1, Point p2, Point p3){
    if(intersect(p0, p1, p2, p3)){
        return 0.0;
    }
    return min(min(getDistanceSP(p0, p1, p2), getDistanceSP(p0, p1, p3)),
                min(getDistanceSP(p2, p3, p0), getDistanceSP(p2, p3, p1)));
}

int main(){
    int xp0, yp0, xp1, yp1;
    scanf("%d", &xp0);
    scanf("%d", &yp0);
    scanf("%d", &xp1);
    scanf("%d", &yp1);

    Point p0 = Point(xp0, yp0);
    Point p1 = Point(xp1, yp1);

    int q;
    scanf("%d", &q);
    for(int i = 0; i < q; i++){
        int x, y;
        scanf("%d", &x);
        scanf("%d", &y);

        cout << counterClockwise(p0, p1, Point(x, y)) << endl;
    }
}

/*
int main(){
    int q;
    scanf("%d", &q);

    for(int i = 0; i < q; i++){
        int xp0, yp0, xp1, yp1, xp2, yp2, xp3, yp3;
        scanf("%d", &xp0);
        scanf("%d", &yp0);
        scanf("%d", &xp1);
        scanf("%d", &yp1);
        scanf("%d", &xp2);
        scanf("%d", &yp2);
        scanf("%d", &xp3);
        scanf("%d", &yp3);

        printf("%.10f\n", getDistance(Point(xp0, yp0), Point(xp1, yp1), Point(xp2, yp2), Point(xp3, yp3)));
    }

}
*/




Measured memory_bytes: 3284