#include <algorithm>
#include <cmath>
#include <iostream>
#include <queue>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#ifndef NULL
#define NULL 0
#endif
using namespace std;

const int MAXN = 50000 + 10;
const double pi = acos(-1.0);
const double inf = 1e100;
const double eps = 1e-10;

inline double read() //浮点型快读
{
    double num;
    char in;
    double Dec = 0.1;
    bool IsN = false, IsD = false;
    in = getchar();
    while (in != '-' && in != '.' && (in < '0' || in > '9'))
        in = getchar();
    if (in == '-') {
        IsN = true;
        num = 0;
    } else if (in == '.') {
        IsD = true;
        num = 0;
    } else
        num = in - '0';
    if (!IsD) {
        while (in = getchar(), in >= '0' && in <= '9') {
            num *= 10;
            num += in - '0';
        }
    }
    if (in != '.') {
        if (IsN)
            num = -num;
        return num;
    } else {
        while (in = getchar(), in >= '0' && in <= '9') {
            num += Dec * (in - '0');
            Dec *= 0.1;
        }
    }
    if (IsN)
        num = -num;
    return num;
}

int zhengfu(double d)
{
    if (fabs(d) < eps)
        return 0;
    if (d > 0)
        return 1;
    return -1;
}
int bijiao(double x, double y)
{
    if (fabs(x - y) < eps)
        return 0;
    if (x > y)
        return 1;
    return -1;
}

struct vec {
    double x, y;
    vec(double x, double y)
    {
        this->x = x;
        this->y = y;
    }
    vec() {}
    vec operator*(const vec& i_T) const
    {
        return vec(x * i_T.x, y * i_T.y);
    }
    vec operator*(double u) const
    {
        return vec(x * u, y * u);
    }
    vec operator/(double u) const
    {
        return vec(x / u, y / u);
    }
    vec operator+(const vec& i_T)
    {
        return vec(x + i_T.x, y + i_T.y);
    }
    vec operator-(const vec& i_T)
    {
        return vec(x - i_T.x, y - i_T.y);
    }
} p[MAXN];
double chaji(vec A, vec B)
{
    return A.x * B.y - A.y * B.x; // 正为A->B左旋
}
double dianji(vec A, vec B)
{
    return A.x * B.x + A.y * B.y;
}

double changdu(vec a) //长度
{
    return sqrt(a.x * a.x + a.y * a.y);
}
vec touying(vec a, vec b, vec c) //c投影在ab上的位置
{
    vec A = b - a;
    vec B = c - a;
    double La = changdu(A);
    double Lc = dianji(A, B) / (La * La);
    return vec(Lc * A.x, Lc * A.y) + a;
}
vec fanshe(vec a, vec b, vec c) //求c关于ab的对称点c'
{
    vec A = touying(a, b, c);
    return (A - c) * 2.0 + c;
}
vec xiangjiao(vec a, vec b, vec c, vec d); //两直线是否相交
vec zhixian_jiaodian(vec a, vec b, vec c, vec d); //两直线交点
int main()
{
    int n;
    vec p1, p2;
    cin >> p1.x >> p1.y >> p2.x >> p2.y >> n;
    for (int i = 0; i < n; i++)
        cin >> p[i].x >> p[i].y;
    for (int i = 0; i < n; i++) {
        if (zhengfu(chaji(p2 - p1, p[i] - p1)) == 1)
            cout << "COUNTER_CLOCKWISE" << endl;
        else if (zhengfu(chaji(p2 - p1, p[i] - p1)) == -1)
            cout << "CLOCKWISE" << endl;
        else {
            if (zhengfu(dianji(p2 - p1, p[i] - p1)) == -1)
                cout << "ONLINE_BACK" << endl;
            else {
                double j = changdu(p2 - p1);
                double k = changdu(p[i] - p1);
                if (bijiao(j, k) >=0)
                    cout << "ON_SEGMENT" << endl;
                else
                    cout << "ONLINE_FRONT" << endl;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3248