// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include<unordered_map>
#include <stack>
#include <random>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

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

template<typename T>
void vdeb(std::vector<T> &da) {
    for (int i = 0;i < da.size();i++) {
        if (i == da.size() - 1) std::cout << da[i];
        else std::cout << da[i] << ' ';
    }
    std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
    for (int i = 0;i < da.size();i++) vdeb(da[i]);
    std::cout << std::endl;
}

class Line{
    public:
    std::complex<double> basepoint;
    std::complex<double> direct;
    Line(){}
    Line(const std::complex<double> &_basepoint, const std::complex<double> &_direct):basepoint(_basepoint){
        assert(abs(_direct) != 0);
        direct = _direct/abs(_direct);
    }
    std::complex<double> basesTrans(const std::complex<double> &p) const { return (p-basepoint)/direct;}
    bool parallel(const std::complex<double> l) const { return basesTrans(l).imag() == 0;}
    bool online(const std::complex<double> &p) const { return parallel(p - basepoint);}
};

class LineSeg: public Line{ //Line Segment
    public:
    std::complex<double> endpoint;
    LineSeg(){}
    LineSeg(const std::complex<double> &_basepoint, const std::complex<double> &_endpoint)
    :Line(_basepoint, _endpoint - _basepoint), endpoint(_endpoint){
        direct = endpoint - basepoint;
    }
    LineSeg(const Line &l, std::complex<double> &p):Line(l) {
        assert(l.online(p));
        endpoint = p;
        direct = endpoint - basepoint;
    }
};

int main(){
    double x1, y1, x2, y2; std::cin >> x1 >> y1 >> x2 >> y2;
    std::complex<double> p0(x1, y1), p1(x2, y2);
    LineSeg ls(p0, p1);
    int q; std::cin >> q;
    std::vector<std::string> ans(q);
    rip(i,q,0){
        double x,y; std::cin >> x >> y;
        std::complex<double> p(x,y);
        std::complex<double> tr = ls.basesTrans(p);
        // std::cout << tr << std::endl;
        if(tr.imag() > 10e-10) ans[i] = "COUNTER_CLOCKWISE";
        else if(tr.imag() < -10e-10) ans[i] = "CLOCKWISE";
        else if(tr.real() < 0) ans[i] = "ONLINE_BACK";
        else if(tr.real() > 1) ans[i] = "ONLINE_FRONT";
        else ans[i] = "ON_SEGMENT";
    }
    rip(i,q,0){
        std::cout << ans[i] << std::endl;
    }
}




Measured memory_bytes: 3380