#include <bits/stdc++.h>
#include <cmath>

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;


void print_line(vector<string> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}

#define EPS 1e-7
const double PI = 3.14159265358979323846;

bool equal(double f1, double f2) {
    return abs(f1 - f2) < EPS;
}

struct Vec {

    double x, y;

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

    double inner_product(Vec v2) {
        return x * v2.x + y * v2.y;
    }

    Vec product(double rate) {
        Vec v2;
        v2.x = x * rate;
        v2.y = y * rate;
        return v2;
    }
};


struct Point {
    double x, y;

    Point plus(Vec vec) {
        Point p;
        p.x = x + vec.x;
        p.y = y + vec.y;
        return p;
    }

    Point minus(Point sub) {
        Point p;
        p.x = x - sub.x;
        p.y = y - sub.y;
        return p;
    }


    friend istream &operator>>(istream &is, Point &f) {
        cin >> f.x >> f.y;
        return is;
    }

    friend ostream &operator<<(std::ostream &os, Point const &f) {
        printf("%.20f %.20f\n", f.x, f.y);
        return os;
    }
};

struct Line {
    Point start, end;

    Vec to_vec() {
        Vec vec;
        vec.x = end.x - start.x;
        vec.y = end.y - start.y;
        return vec;
    }

    friend istream &operator>>(istream &is, Line &f) {
        cin >> f.start >> f.end;
        return is;
    }

    Line normalize() {
        Line l;
        l.start = {0, 0};
        l.end = end.minus(start);
        return l;
    }

    double atan2() {
        Line l = normalize();
        return std::atan2(l.end.y, l.end.x);
    }

    double rad(Line line) {
        double f1 = atan2(),
                f2 = line.atan2();

        double diff = f1 - f2;

        if (diff < -PI) {
            diff += (PI * 2);
        }
        if (diff > PI) {
            diff -= (2 * PI);
        }
        return diff;
    }

    void clock_wise(Line line) {

        double diff = rad(line);

        if (equal(line.to_vec().size(), 0)) {
            cout << "ON_SEGMENT" << endl;
            return;
        }

        if (equal(diff, 0)) {
            double s1 = to_vec().size();
            double s2 = line.to_vec().size();

            if (s1 > s2 || equal(s1, s2)) {
                cout << "ON_SEGMENT" << endl;
            } else {
                cout << "ONLINE_FRONT" << endl;
            }
        } else if (equal(abs(diff), PI)) {
            cout << "ONLINE_BACK" << endl;
        } else if (diff < 0) {
            cout << "COUNTER_CLOCKWISE" << endl;
        } else {
            cout << "CLOCKWISE" << endl;
        }
    }

};


int main() {
    Line line;
    cin >> line;

    int q;
    cin >> q;
    rep(i, q) {

        Line line2;
        line2.start = line.start;
        cin >> line2.end;

        line.clock_wise(line2);

    }
}



Measured memory_bytes: 3476