#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<math.h>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
#include<chrono>
#include<unordered_map>
#include<list>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pdl;
const ll E=1e18+7;
#define F first
#define S second
#define MK make_pair
const ll MOD=1000000007;

template<typename T> //double or long long
class Geometry{
private:
    typedef pair<T,T> point;
    typedef point Vector;
    typedef pair<point,point> line;
    vector<point> P;
    
public:
    Geometry(vector<point> P={}):P(P){}
    
    void add_point(point p){P.push_back(p);}
    
    void Sort(){
        sort(P.begin(),P.end());
    }
    
    //from first,to second
    Vector line_Vector(line a){
        return {a.S.F-a.F.F,a.S.S-a.F.S};
    }
    
    T dot(line a,line b){
        return dot(line_Vector(a),line_Vector(b));
    }
    
    T dot(Vector a,Vector b){
        return a.F*b.F+a.S*b.S;
    }
    
    T cross(line a,line b){
        return cross(line_Vector(a),line_Vector(b));
    }
    
    T cross(Vector a,Vector b){
        return a.F*b.S-a.S*b.F;
    }
    
    T norm(line a){
        return dot(a,a);
    }
    
    T norm(Vector a){
        return dot(a,a);
    }
    
    double abs(line a){
        return sqrt(norm(a));
    }
    
    double abs(Vector a){
        return sqrt(norm(a));
    }
    
    //線分と点の距離
    double abs(line l,point p){
        if(dot(l,{l.F,p})<0){return abs(l.F,p);}
        if(dot(reverse(l),{l.S,p})<0){return abs(l.S,p);}
        return dist(l,p);
    }
    
    double abs(line a,line b){
        if(intersect(a,b)){return 0;}
        return min(min(abs(a,b.F),abs(a,b.S)),
        min(abs(b,a.F),abs(b,a.S)));
    }
    
    point move(point p,Vector v){
        return {p.F+v.F,p.S+v.S};
    }
    
    Vector reverse(Vector v){return {-1*v.F,-1*v.S};}
    
    line reverse(line l){return {l.S,l.F};}
    
    Vector times(Vector v,T time){return {v.F*time,v.S*time};}
    
    Vector to_norm(Vector v,T norm){
        T dist=norm(v);
        return times(v,norm/dist);
    }
    
    //ダブル型でのみ使うこと
    Vector to_abs(Vector v,double abs){
        return to_norm(v,abs);
    }
    
    /*
     aが基点
     0::零ベクトルがある
     1::重なっている
     2::反対向き
     3::反時計回り
     4:: 時計回り
     */
    ll clockwise(Vector a,Vector b){
        T C=cross(a,b);
        T D=dot(a,b);
        if(C==0 && D==0){return 0;}
        if(C==0 && D>0){return 1;}
        if(C==0 && D<0){return 2;}
        if(C>0){return 3;}
        return 4;
    }
    
    ll clockwise(line a,line b){return clockwise(line_Vector(a),line_Vector(b));}
    
    vector<point> convex_hull(){
        assert(P.size()>=3);
        vector<point> a=P;
        sort(a.begin(),a.end());
        vector<point> up;
        up.push_back(a[0]);
        up.push_back(a[1]);
        for(int i=2;i<a.size();i++){
            point p=a[i];
            while(up.size()>=2 && cross({up[up.size()-2],up[up.size()-1]},{up[up.size()-1],p})>=0){
                up.pop_back();
            }
            up.push_back(p);
        }
        reverse(a.begin(),a.end());
        vector<point> down;
        down.push_back(a[0]);
        down.push_back(a[1]);
        for(int i=2;i<a.size();i++){
            point p=a[i];
            while(down.size()>=2 && cross({down[down.size()-2],down[down.size()-1]},{down[down.size()-1],p})>=0){
                down.pop_back();
            }
            down.push_back(p);
        }
        vector<point> ret;
        for(int i=0;i<up.size();i++){
            ret.push_back(up[i]);
        }
        for(int i=1;i<down.size()-1;i++){
            ret.push_back(down[i]);
        }
        return ret;
    }
    
    T max_norm(){
        vector<point> P=convex_hull();
        T mx=0;
        ll where=0;
        for(int i=0;i<P.size();i++){
            if(norm({P[0],P[i]})>=mx){mx=norm({P[0],P[i]}); where=i;}
        }
        mx=0;
        for(int i=0;i<P.size();i++){
            while(norm({P[i],P[where]})<=norm({P[i],P[(where+1)%P.size()]})){
                where=(where+1)%P.size();
            }
            mx=max(mx,norm({P[i],P[where]}));
        }
        return mx;
    }
    
    double max_dist(){return sqrt(max_norm());}
    
    //ダブル型でのみ使うこと
    point shadow(line l,point p){
        Vector base=line_Vector(l);
        Vector P=line_Vector({l.F,p});
        double r=dot(P,base)/norm(base);
        return move(l.F,times(base,r));
    }
    
    //qが中心
    point reflection(point p,point q){
        Vector m=line_Vector({p,q});
        return move(q,m);
    }
    
    point reflection(line l,point p){
        point center=shadow(l,p);
        return reflection(p,center);
    }
    
    //直線と点の距離
    double dist(line l,point p){
        point q=shadow(l,p);
        return abs(p,q);
    }
};


/*
 aが基点
 0::零ベクトルがある
 1::重なっている
 2::反対向き
 3::反時計回り
 4:: 時計回り
 */

int main(){
    cout<<fixed<<setprecision(12);
    Geometry<ll> G;
    ll x1,y1,x2,y2;
    cin>>x1>>y1>>x2>>y2;
    pll a={x1,y1};
    pll b={x2,y2};
    ll q;
    cin>>q;
    while(q--){
        ll X,Y;
        cin>>X>>Y;
        pll c={X,Y};
        ll ans=G.clockwise({a,b},{a,c});
        if(ans==3){cout<<"COUNTER_CLOCKWISE"<<endl;}
        else if(ans==4){cout<<"CLOCKWISE"<<endl;}
        else if(ans==2){cout<<"ONLINE_BACK"<<endl;}
        else if(G.abs({a,b})>=G.abs({a,c})){cout<<"ON_SEGMENT"<<endl;}
        else{cout<<"ONLINE_FRONT"<<endl;}
    }
    
    
    return 0;
}



Measured memory_bytes: 3128