#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using ui = unsigned int;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;
const double EPS = 1E-10;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}


class Point2D{
    double x, y;
public:
    Point2D(double X=0, double Y=0): x(X), y(Y){}
    Point2D(const Point2D& v): x(v.x), y(v.y){}
    template<class T>
    Point2D(const vector<T> &v){
        assert(v.size() == 2);
        x = v[0]; y = v[1];
    }
    template<class T, class T2>
    Point2D(const pair<T, T2> &p){
        x = p.first; y = p.second;
    }

    void setX(double X){x = X;}
    double getX(){return x;}
    void setY(double Y){y = Y;}
    double getY(){return y;}

    Point2D operator+() const{return *this;}
    Point2D operator-() const{return Point2D(-x, -y);}

    Point2D& operator=(const Point2D& v){
        x = v.x; y = v.y;
        return *this;
    }

    Point2D& operator+=(const Point2D& v){
        x += v.x; y += v.y;
        return *this;
    }

    Point2D& operator-=(const Point2D& v){
        x -= v.x; y -= v.y;
        return *this;
    }

    Point2D& operator*=(const double a){
        x *= a; y *= a;
        return *this;
    }

    Point2D& operator/=(const double a){
        x /= a; y /= a;
        return *this;
    }

    Point2D operator+(const Point2D& v) const{
        Point2D tmp(*this);
        return tmp += v;
    }

    Point2D operator-(const Point2D& v) const{
        Point2D tmp(*this);
        return tmp -= v;
    }

    Point2D operator*(const double a) const{
        Point2D tmp(*this);
        return tmp *= a;
    }

    friend Point2D operator*(double a, const Point2D v){
        return v * a;
    }

    Point2D operator/(const double a) const{
        Point2D tmp(*this);
        return tmp /= a;
    }

    double norm(){return x*x + y*y;}
    friend double norm(Point2D &v){return v.norm();}
    double abs(){return sqrt(norm());}
    friend double abs(Point2D &v){return v.abs();}

    bool operator<(const Point2D &v) const{
        return x != v.x ? x < v.x : y < v.y;
    }

    bool operator>(const Point2D &v) const{
        return x != v.x ? x > v.x : y > v.y;
    }

    bool operator==(const Point2D &v) const{
        return std::abs(x - v.x) < EPS
            && std::abs(y - v.y) < EPS;
    }

    bool operator<=(const Point2D &v) const{
        return (*this < v) || (*this == v);
    }

    bool operator>=(const Point2D &v) const{
        return (*this > v) || (*this == v);
    }

    friend double dot(Point2D a, Point2D b){
        return a.x*b.x + a.y*b.y;
    }

    friend double cross(Point2D a, Point2D b){
        return a.x*b.y - a.y*b.x;
    }

    friend double distance(Point2D a, Point2D b){
        return (a - b).abs();
    }
};
using Vector2D = Point2D;

class Line2D{
    Point2D p1, p2;
public:
    Line2D(){}
    Line2D(Point2D a, Point2D b): p1(a), p2(b){}

    void setP1(const Point2D p){p1 = p;}
    Point2D getP1(){return p1;}
    void setP2(const Point2D p){p2 = p;}
    Point2D getP2(){return p2;}

    friend Point2D project(Line2D l, Point2D p){
        Point2D base = l.p2 - l.p1;
        double r = dot(p - l.p1, base) / norm(base);
        return l.p1 + base * r;
    }

    friend Point2D reflect(Line2D l, Point2D p){
        return p + 2.0 * (project(l, p) - p);
    }
};

int ccwSearch(Point2D a, Point2D b){
    if(cross(a, b) > EPS) return 0;//CCW
    if(cross(a, b) < -EPS) return 1;//CW
    if(dot(a, b) < -EPS) return 2;//OLB
    if(norm(a) < norm(b)) return 3;//OLF
    return 4;//OS
}


int main(){
    string ans[] = {"COUNTER_CLOCKWISE", "CLOCKWISE",
                    "ONLINE_BACK", "ONLINE_FRONT", "ON_SEGMENT"};

    double x0, y0, x1, y1; cin >> x0 >> y0 >> x1 >> y1;
    Point2D p0(x0, y0), p1(x1, y1);
    Point2D a = p1 - p0;
    int q; cin >> q;
    REP(i, q){
        double x, y; cin >> x >> y;
        Point2D b = Point2D(x, y) - p0;
       // cout << cross(a, b) << endl;
        cout << ans[ccwSearch(a, b)] << "\n";
    }
    return 0;
}



Measured memory_bytes: 3280