#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

struct Point
{
    ll x,y;
    Point(){ x = y = 0.0; }
    Point(ll _x, ll _y) : x(_x), y(_y){}

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

    Point operator- (Point p)
    {
        return Point(x - p.x, y - p.y);
    }

    ll operator* (Point p)
    {
        return p.x * x + p.y * y;
    }

    Point operator* (ll t)
    {
        return Point(x*t, y*t);
    }

    ll operator~ ()
    {
        return x * x + y * y;
    }

    ll operator% (Point p)
    {
        return x * p.y - y * p.x;
    }

};

int main()
{
    cout.precision(10);
    cout << fixed;
    int q;
    Point p0, p1, p2, vec, vec1;
    cin >> p0.x >> p0.y >> p1.x >> p1.y;
    cin >> q;
    while(q--)
    {
        cin >> p2.x >> p2.y;
        vec = (p2 - p0);
        vec1 = (p1 - p0);
        if( vec%vec1 < 0LL ) puts("COUNTER_CLOCKWISE");
        else if( vec%vec1 > 0LL) puts("CLOCKWISE");
        else
        {
            if(vec * vec1 < 0LL) puts("ONLINE_BACK");
            else
            {
                if(~vec > ~vec1) puts("ONLINE_FRONT");
                else puts("ON_SEGMENT");
            }
        }
    }

    return 0;
}