#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

// #define DEBUG

class Point;
Point pointprojection(Point a, Point b, Point c);
Point pointreflection(Point a, Point b, Point c);
void pointargument(Point a, Point b, Point c);

class Point
{
    double x;
    double y;

public:
    void printpoint();
    double norm();
    friend Point operator+(Point a, Point b);
    friend double operator*(Point a, Point b);
    friend Point operator*(double a, Point b);
    friend Point operator*(Point a, double b);
    friend Point operator/(Point a, double b);
    friend double operator/(Point a, Point b);
    friend Point operator-(Point a, Point b);
    double dot(Point b);
    Point(double a, double b)
    {
        x = a;
        y = b;
    }
    double get_x() { return x; }
    double get_y() { return y; }
};

void Point::printpoint()
{
    printf("%.8f  %.8f\n", x, y);
}

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

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

double operator*(Point a, Point b)
{
    return double(a.x * b.y - a.y * b.x);
}
Point operator*(double a, Point b)
{
    return Point(a * b.get_x(), a * b.get_y());
}
Point operator*(Point a, double b)
{
    return Point(a.get_x() * b, a.get_y() * b);
}
Point operator/(Point a, double b)
{
    return Point(a.get_x() / b, a.get_y() / b);
}
double operator/(Point a, Point b)
{
    double ret;
    if (b.get_x() != 0)
        ret =  a.get_x() / b.get_x();
    else if (b.get_y() != 0)
        ret = a.get_y() / b.get_y();
    return ret;
}
Point operator-(Point a, Point b)
{
    return Point(a.x - b.x, a.y - b.y);
}

double Point::dot(Point b)
{
    return x * b.x + y * b.y;
}

void printarray(int n, int a[])
{
    for (int i = 1; i < n + 1; i++)
    {
        cout << a[i];
        if (i != n)
            cout << " ";
    }
    cout << endl;
}

Point pointprojection(Point a, Point b, Point c)
{
    Point v1 = b - a;
    Point v2 = c - a;
    Point d = v1 * (v1.dot(v2) / (v1.norm() * v1.norm())) + a;
    return d;
}

Point pointreflection(Point a, Point b, Point c)
{
    Point d = pointprojection(a, b, c);
    Point e = 2 * d - c;
    return e;
}

void pointargument(Point a, Point b, Point c)
{
    Point vba = b - a;
    Point vca = c - a;
    double s = vba * vca;
    if (s > 0)
        cout << "COUNTER_CLOCKWISE" << endl;
    else if (s < 0)
        cout << "CLOCKWISE" << endl;
    else
    {
        double p = vca / vba;
        if (p < 0)
            cout << "ONLINE_BACK" << endl;
        else if (0 <= p && p <= 1)
            cout << "ON_SEGMENT" << endl;
        else if (1 < p)
            cout << "ONLINE_FRONT" << endl;
    }
}

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    double a, b, c, d, e, f, q;
    cin >> a >> b >> c >> d;
    Point p1(a, b);
    Point p2(c, d);
    cin >> q;
    for (int i = 0; i < q; i++)
    {
        cin >> e >> f;
        Point p3(e, f);
        pointargument(p1, p2, p3);
    }
    return 0;
}

// getline(cin,s);
// a = strtok(s, ",");  ","で分解
// for (int i = 0; i < n; i++)


Measured memory_bytes: 3216