    #include <bits/stdc++.h>
    using namespace std;
    #define Int int64_t
    #define dump(x) cout << (x) << endl
    #define fi first
    #define se second
    Int mod = 1e9+7;
    Int INF = 1e18;
    double EPS = 0.00000001;
    //Int mod = 1e6+3;

    int main() {
        double ax, ay, bx, by;
        cin >> ax >> ay >> bx >> by;
        complex<double> a(ax, ay), b(bx, by);
        int q;
        cin >> q;
        for (int i = 0; i < q; i++) {
            double px, py;
            cin >> px >> py;
            complex<double> p(px, py);
            complex<double> ab = (b - a), ap = (p - a);
            complex<double> e = ab / abs(ab);
            ap = ap / e;
            if (imag(ap) - EPS > 0) {
                dump("COUNTER_CLOCKWISE");
            }
            else if (imag(ap) + EPS < 0) {
                dump("CLOCKWISE");
            }
            else {
                if (real(ap) + EPS < 0) {
                    dump("ONLINE_BACK");
                }
                else if (real(ap) - EPS > abs(ab)) {
                    dump("ONLINE_FRONT");
                }
                else {
                    dump("ON_SEGMENT");
                }
            }
        }
        return 0;
    }
