#include <bits/stdc++.h>
#define MX 1000000
#define pf printf
#define sf scanf
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define db double
#define fl float
#define ii pair <int,int>
#define ff first
#define ss second
#define pb push_back
#define ps push
#define pp pop()
#define tp top()
#define ft front()
#define cl clear()
#define max3(a,b,c) max(a, max(b,c))
#define min3(a,b,c) min(a, min(b,c))
#define SA(name,size) sort(name, name+size)
#define SV(name) sort(name.begin(), name.end())
#define RV(name) reverse(name.begin(), name.end());
#define loop(a,n) for(int i=a; i<n; i++)
#define nloop(j,a,n) for(int j=a; j<n; j++)
#define Case int T; scanf("%d", &T); for(int cas = 1; cas <= T; ++cas)
#define CaseF(n) for(int cas=1; cas<=n; cas++)
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define pr(x) cout << x << endl
#define pr2(x,y) cout << x << " " << y << endl
#define prln pf("\n")
using namespace std;

/**------------------------------Graph Moves-----------------------------------*/
/* anti-clockwise, starting from 0 degree */
///int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; // 4 direction
///int dx[]={1,1,0,-1,-1,-1,0,1}; int dy[]={0,1,1,1,0,-1,-1,-1}; //8 direction
///int dx[]={2,1,-1,-2,-2,-1,1,2}; int dy[]={1,2,2,1,-1,-2,-2,-1}; //Knight Direction
///int dx[]={2,1,-1,-2,-1,1}; int dy[]={0,1,1,0,-1,-1}; //Hexagonal Direction
/*----------------------------------------------------------------------------*/

int bigmod(int n, int pow, int mod){
    if(pow==0) return 1;
    int x=bigmod(n, pow/2, mod);
    x=((x%mod)*(x%mod))%mod;
    if(pow%2==1) x=((x%mod)*(n%mod))%mod;
    return x;
}

inline int getint(){
    int x;
    scanf("%d",&x);
    return x;
}
#define II getint()

inline long long getlonglong(){
    long long x;
    scanf("%lld",&x);
    return x;
}
#define LL getlonglong()

inline float getfloat(){
    float x;
    scanf("%f",&x);
    return x;
}
#define FF getfloat()

inline double getdouble(){
    double x;
    scanf("%lf",&x);
    return x;
}
#define DB getdouble()

inline string getstring(){
    string s;
    cin>>s;
    return s;
}
#define SS getstring()

/**------------------------------------------------------------------------------------------*/

struct point{
    double x,y;
    double operator ^ (point b){
        return x*b.y - y*b.x;
    }
    double operator * (point b){
        return x*b.x + y*b.y;
    }
    point operator - (point b){
        point Vector;
        Vector.x = x-b.x;
        Vector.y = y-b.y;
        return Vector;
    }
};

double Distance(point a, point b){
    return abs( sqrt( (b.x-a.x)*(b.x-a.x) + (b.y-a.y)*(b.y-a.y) ) );
}

int main(){
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);

    point p0, p1, p2;
    sf("%lf %lf %lf %lf",&p0.x,&p0.y,&p1.x,&p1.y);
    int q;
    sf("%d",&q);
    while(q--){
        sf("%lf %lf",&p2.x,&p2.y);
        point A = p1-p0; /// vector A (p0 to p1)
        point B = p2-p0; /// vector B (p0 to p2)
        if((A^B)>0)
            pf("COUNTER_CLOCKWISE\n");
        else if((A^B)<0)
            pf("CLOCKWISE\n");
        else if((A^B)==0){
            if((A*B)<0)
                pf("ONLINE_BACK\n");
            else{
                double dis_p0p1 = Distance(p0,p1);
                double dis_p0p2 = Distance(p0,p2);
                if(dis_p0p1 < dis_p0p2)
                    pf("ONLINE_FRONT\n");
                else
                    pf("ON_SEGMENT\n");
            }
        }
    }

    return 0;
}



Measured memory_bytes: 3220