#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define Vector Point
#define INF 2000000000
#define sq(x) ((x)*(x))
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)

// ***** 幾何ライブラリ　線分と直線に注意!! 誤差に注意すること!! *****

inline double add(double a,double b){
	if(abs(a+b)<eps*(abs(a)+abs(b)))return 0;
	return a+b;
}

struct Point{
	double x,y;
	Point() {}
	Point(double x,double y) : x(x),y(y){}
	Point operator + (Point p){return Point(add(x,p.x),add(y,p.y));}
	Point operator - (Point p){return Point(add(x,-p.x),add(y,-p.y));}
	Point operator * (double d){return Point(x*d,y*d);}
	double dot(Point p){return add(x*p.x,y*p.y);}
	double det(Point p){return add(x*p.y,-y*p.x);}
	double norm(){return sqrt(x*x+y*y);}
	double norm2(){return x*x+y*y;}
	double dist2(Point p){return sq(x-p.x)+sq(y-p.y);}
	Point vert(){return Point(y,-x);}
	void dump(const char* msg=""){printf("%s(%.12f,%.12f)\n",msg,x,y);return;}
	
	// following functions for vector operation

	// signed area of triange (0,0) (x,y) (p.x,p.y)
	double area(Point p){
		return (x*p.y-p.x*y)/2.0;
	}
};
// direction a -> b -> c
int ccw(Point a,Point b,Point c){
	Vector p = b-a;
	Vector q = c-a;
	if(p.det(q)>0.0)return 1; // counter clockwise
	if(p.det(q)<0.0)return -1; // clockwise
	if(p.dot(q)<0.0)return 2; // c--a--b online_back
	if(p.norm()<q.norm())return 3; // a--b--c online_front 
	return 4;// a--c--b on_segment
}
struct Line{
	Point a,b;
	Line(){}
	Line(Point a,Point b):a(a),b(b){}
	bool on(Point q){
		return (a-q).det(b-q)==0; 
	}
	bool is_parallel(Line l){
		return (a-b).det(l.a-l.b)==0;
	}
	Point intersection(Line l){
		assert(!is_parallel(l));
		return a+(b-a)*((l.b-l.a).det(l.a-a)/(l.b-l.a).det(b-a));
	}
	// projection of p to this line
	// verified AOJ CGL_1_A
	Point projection(Point p){
		return (b-a)*((b-a).dot(p-a)/(b-a).norm2())+a;
	}
	// reflection point of p onto this line
	// verified AOJ CGL_1_B
	Point refl(Point p){
		Point proj = projection(p);
		return p+((proj-p)*2.0);
	}
};
struct Segment{
	Point a,b;
	Segment(){}
	Segment(Point a,Point b):a(a),b(b){}
	Line line(){
		return Line(a,b);
	}
	bool on(Point q){
		return ((a-q).det(b-q)==0&&(a-q).dot(b-q)<=0); 
	}
	bool is_intersect(Segment s){
		if(a.x>b.x)swap(a,b);
		if(s.a.x>s.b.x)swap(s.a,s.b);
		Point k = line().intersection(s.line());
		if((a.x<=k.x)&&(k.x<=b.x)&&(s.a.x<=k.x)&&(k.x<=s.b.x))return true;
		else return false;
	}
	bool is_intersect(Line l){
		if(a.x>b.x)swap(a,b);
		if(l.a.x>l.b.x)swap(l.a,l.b);
		Point k = line().intersection(l);
		if((a.x<=k.x)&&(k.x<=b.x))return true;
		else return false;
	}
};
typedef vector<Point> Polygon;

int main(){
	Point p1,p2;
	cin >> p1.x >> p1.y >> p2.x >> p2.y;
	int q;
	cin >> q;
	for(int i=0;i<q;i++){
		Point p3;
		cin >> p3.x >> p3.y;
		int ans = ccw(p1,p2,p3);
		if(ans==1)cout << "COUNTER_CLOCKWISE" << endl;
		if(ans==-1)cout << "CLOCKWISE" << endl;
		if(ans==2)cout << "ONLINE_BACK" << endl;
		if(ans==3)cout << "ONLINE_FRONT" << endl;
		if(ans==4)cout << "ON_SEGMENT" << endl;
	}
	return 0;
}


Measured memory_bytes: 3232