#define loop(i, s, e) for(ll i = s;i < e;i++)

#include <iostream>
#include <iomanip>
#include <set>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <algorithm>
#include <map>
#include <cmath>

using namespace std;

typedef long long signed ll;

#define NAN_M 0x800000000000

template<typename T>
class Vector2D {
public:
    T x;
    T y;

    Vector2D() {
        x = y = 0;
    }

    Vector2D(T x_, T y_) {
        x = x_;
        y = y_;
    }

    T operator*(const Vector2D<T> *e) {
        return this->x * e->x + this->y * e->y;
    }

    Vector2D<T> operator-(const Vector2D<T> *e) {
        return Vector2D<T>(this->x - e->x, this->y - e->y);
    }

    Vector2D<T> operator+(const Vector2D<T> *e) {
        return Vector2D<T>(this->x + e->x, this->y + e->y);
    }

    T operator*(const Vector2D<T> e) {
        return this->x * e.x + this->y * e.y;
    }

    Vector2D<T> operator-(const Vector2D<T> e) {
        return Vector2D<T>(this->x - e.x, this->y - e.y);
    }

    Vector2D<T> operator+(const Vector2D<T> e) {
        return Vector2D<T>(this->x + e.x, this->y + e.y);
    }

    Vector2D<T> operator*(const T r) {
        return Vector2D<T>(this->x * r, this->y * r);
    }

    Vector2D<T> operator/(const T r) {
        return Vector2D<T>(this->x / r, this->y / r);
    }

    double abs() {
        return sqrt(x * x + y * y);
    }

    T abs2() {
        return x * x + y * y;
    }

    T cross(Vector2D<T> e) {
        if(x * e.y >= y * e.x) return (x * e.y) - (y * e.x);
        else return (y * e.x) - (x * e.y);
    }

    double cos(Vector2D<T> e) {
        if((e.abs() * abs()) == 0) return NAN_M;
        return (e * (*this)) / (e.abs() * abs());
    }

    double sin(Vector2D<T> e) {
        if((e.abs() * abs()) == 0) return NAN_M;
        return ((x * e.y) - (y * e.x)) / (e.abs() * abs());
    }
};

typedef Vector2D<double> vdd;

double dist__(double x0, double y0, double x1, double y1, double xx, double yy) {
    int b = 0;
    vdd p[3] = {vdd(x0, y0), vdd(x1, y1), vdd(xx, yy)};
    if (((p[0] - p[1]) * (p[2] - p[1])) < 0) b = -1;
    if (((p[1] - p[0]) * (p[2] - p[0])) < 0) b = 1;
    if (b == 1) return (p[2] - p[0]).abs();
    if (b == -1) return (p[2] - p[1]).abs();
    return (p[1] - p[0]).cross(p[2] - p[0]) / (p[1] - p[0]).abs();
}

double dist(double x0, double y0, double x1, double y1, double xx, double yy){
    double res = dist__(x0,y0,x1,y1,xx,yy);
    return res;
}
int main() {
    int q;
    vdd base,p;
    cin >> base.x >> base.y >> p.x >> p.y;
    cin >> q;
    loop(i, 0, q) {
        vdd z;
        cin >> z.x >> z.y;
        double cos = (p-base).cos(z-base);
        double sin = (p-base).sin(z-base);
        double cosr = (base-p).cos(z-p);
        if(cos == NAN_M || cosr == NAN_M)
            cout << "ON_SEGMENT" << endl;
        else if(abs(cos - 1) < 0.0000000001 && abs(cosr - 1) < 0.0000000001)
            cout << "ON_SEGMENT" << endl;
        else if(abs(cos - 1) < 0.0000000001)
            cout << "ONLINE_FRONT" << endl;
        else if(abs(cos + 1) < 0.0000000001)
            cout << "ONLINE_BACK" << endl;
        else if(sin < 0)
            cout << "CLOCKWISE" << endl;
        else if(sin > 0)
            cout << "COUNTER_CLOCKWISE" << endl;
        else
            cout << "ON_SEGMENT" << endl;
    }
}




Measured memory_bytes: 3216