// Template
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <map>
#include <set>
#include <algorithm>
#include <utility>
#include <cmath>
#include <complex>
#define rep(i, x) for (int i = 0; i < (x); ++i)
#define rng(i, x, y) for (int i = (x); i < (y); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using namespace std;
using ll = long long;
constexpr int inf = 1001001001;
constexpr ll INF = 3003003003003003003;
template <typename T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <typename T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}

// Geometry

constexpr double EPS = 1E-9;
int sgn(double x) {return x < -EPS ? -1 : x > EPS ? 1 : 0;}

struct point {
    double x, y;
    point() = default;
    point(double x_, double y_) : x(x_), y(y_) {}
    point &operator+= (const point &p) {x += p.x; y += p.y; return *this;}
    point &operator-= (const point &p) {x -= p.x; y -= p.y; return *this;}
    point &operator*= (double k) {x *= k; y *= k; return *this;}
    point &operator/= (double k) {x /= k; y /= k; return *this;}
    point operator+ (const point &p) const {return point(*this) += p;}
    point operator- (const point &p) const {return point(*this) -= p;}
    point operator* (double k) const {return point(*this) *= k;}
    point operator/ (double k) const {return point(*this) /= k;}
    point operator- () const {return point(*this) *= -1;}
    point rotation(double theta) const {return point(x * cos(theta) - y * sin(theta), x * sin(theta) + y * cos(theta));}
    double length() const {return sqrt(x * x + y * y);}
    double dot(point &p) const {return x * p.x + y * p.y;}
    double cross(point &p) const {return x * p.y - y * p.x;}
    double arg() const {return atan2(y, x);}
    bool operator<(const point &p) {if (sgn(x - p.x)) return sgn(x - p.x) < 0; return sgn(y - p.y) < 0;}
    friend istream &operator>> (istream &is, point &p) {is >> p.x >> p.y; return is;}
    friend ostream &operator<< (ostream &os, point &p) {os << "{" << p.x << ", " << p.y << "}"; return os;}
};

int isp(const point &a, const point &b, const point &c) {
    point p = a - b, q = c - a;
    if (sgn(p.cross(q)) < 0) return 1;
    if (sgn(p.cross(q)) > 0) return -1;
    p = b - a; q = c - a;
    if (sgn(p.dot(q)) < 0) return -2;
    p = a - b; q = c - b;
    if (sgn(p.dot(q)) < 0) return 2;
    return 0;
}


// Main Code
int main() {
    point a, b;
    cin >> a >> b;
    int q;
    cin >> q;
    rep(_, q) {
        point c;
        cin >> c;
        switch (isp(a, b, c)) {
            case -2:
                cout << "ONLINE_BACK\n";
                break;
            case -1:
                cout << "CLOCKWISE\n";
                break;
            case 0:
                cout << "ON_SEGMENT\n";
                break;
            case 1:
                cout << "COUNTER_CLOCKWISE\n";
                break;
            case 2:
                cout << "ONLINE_FRONT\n";
                break;
        }
    }
    return 0;
}



Measured memory_bytes: 3216