#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<cmath>
#include<list>
#include<map>
#include<set>
using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef stack<int> SI;
typedef queue<int> QI;
typedef list<int> LI;
typedef pair<int,int> PII;
typedef long long LL;

#define d(x)  cout<<#x<<" = "<<(x)<<endl;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EMP empty()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define REACH(i,c) for(typeof((c).rbegin()) i=(c).rbegin(); i!=(c).rend(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c,n) sort(c,c+n)
#define VSORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define DFOR(i,b,a) for(int i=(b)-1;i>=(a);--i)
#define DREP(i,n) DFOR(i,n,0)
#define INF 1000000000
#define PI  acos(-1.0)
////////////////////////////////////////////////
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)
class Vector
{
public:
	double x,y;
	Vector(double x=0,double y=0):x(x),y(y){}
	
	Vector operator + (Vector p){return Vector(x+p.x,y+p.y);}
	Vector operator - (Vector p){return Vector(x-p.x,y-p.y);}
	Vector operator * (double a){return Vector(x*a,y*a);}
	Vector operator / (double a){return Vector(x/a,y/a);}
	
	double abs(){return sqrt(norm());}
	double norm(){return x*x+y*y;}
	
	bool operator <  (const Vector &p)const{return x!=p.x?x<p.x:y<p.y;}
	bool operator == (const Vector &p)const{return fabs(x-p.x)<EPS && fabs(y-p.y<EPS);}
};

double dot(Vector a,Vector b){return a.x*b.x+a.y*b.y;}
double cross(Vector a,Vector b){return a.x*b.y-b.x*a.y;}

int ccw(Vector p0,Vector p1,Vector p2)
{
	Vector a=p1-p0;
	Vector b=p2-p0;
	if(cross(a,b)>EPS)return 1;//???????¨???????
	if(cross(a,b)<-EPS)return -1;//????¨???????
	if(dot(a,b)<-EPS)return 2;//p0?????????
	if(a.norm()<b.norm())return -2;//p1????\\
	return 0;//?????????
}

int main()
{
	Vector p0,p1,p2;
	cin>>p0.x>>p0.y>>p1.x>>p1.y;
	int n;cin>>n;
	REP(i,n)
	{
		cin>>p2.x>>p2.y;
		int j=ccw(p0,p1,p2);
		if(j==1)cout<<"COUNTER_CLOCKWISE"<<endl;
		else if(j==-1)cout<<"CLOCKWISE"<<endl;
		else if(j==2)cout<<"ONLINE_BACK"<<endl;
		else if(j==-2)cout<<"ONLINE_FRONT"<<endl;
		else cout<<"ON_SEGMENT"<<endl;
	}
	return 0;
}

/*
int main()
{
	int n;cin>>n;
	vtr p[4];
	cout<<fixed<<setprecision(10);
	REP(i,n)
	{
		REP(j,4)cin>>p[j].x>>p[j].y;
		//????????????
		double a,b,c,d;
		if(dotp(minusvtr(p[1],p[0]),minusvtr(p[2],p[0]))>0&&dotp(minusvtr(p[0],p[1]),minusvtr(p[2],p[1]))>0)
		{
			a=abscrossp(minusvtr(p[1],p[0]),minusvtr(p[2],p[0]))/absvtr(minusvtr(p[1],p[0]));
		}
		else
		{
			a=min(absvtr(minusvtr(p[2],p[0])),absvtr(minusvtr(p[2],p[1])));
		}
		
		if(dotp(minusvtr(p[1],p[0]),minusvtr(p[3],p[0]))>0&&dotp(minusvtr(p[0],p[1]),minusvtr(p[3],p[1]))>0)
		{
			b=abscrossp(minusvtr(p[1],p[0]),minusvtr(p[3],p[0]))/absvtr(minusvtr(p[1],p[0]));
		}
		else
		{
			b=min(absvtr(minusvtr(p[3],p[0])),absvtr(minusvtr(p[3],p[1])));
		}
		
		if(dotp(minusvtr(p[3],p[2]),minusvtr(p[0],p[2]))>0&&dotp(minusvtr(p[2],p[3]),minusvtr(p[0],p[3]))>0)
		{
			c=abscrossp(minusvtr(p[3],p[2]),minusvtr(p[0],p[2]))/absvtr(minusvtr(p[3],p[2]));
		}
		else
		{
			c=min(absvtr(minusvtr(p[0],p[2])),absvtr(minusvtr(p[0],p[3])));
		}
		
		if(dotp(minusvtr(p[3],p[2]),minusvtr(p[1],p[2]))>0&&dotp(minusvtr(p[2],p[3]),minusvtr(p[1],p[3]))>0)
		{
			d=abscrossp(minusvtr(p[3],p[2]),minusvtr(p[1],p[2]))/absvtr(minusvtr(p[3],p[2]));
		}
		else
		{
			d=min(absvtr(minusvtr(p[1],p[2])),absvtr(minusvtr(p[1],p[3])));
		}
		cout<<min(min(a,b),min(c,d))<<endl;
	}
	return 0;
}*/

Measured memory_bytes: 3216