#include<iostream>
#include<cmath>
#include<iomanip>
#include<cstdio>
using namespace std;
#define EPS 1e-10
static const int COUNTER_CLOCKWISE = 1;					//逆时针   
static const int CLOCKWISE = 2;							//顺时针
static const int ONLINE_BACK = 3;						//p2 在直线后面
static const int ONLINE_FRONT = 4;						//p2 在直线前面
static const int ON_SEGMENT = 0;						//p2 在直线上
int equals(double a, double b) { return fabs(a - b) < EPS; };
class Point {
public:
	double x, y;
	Point(double x=0, double y=0) :x(x), y(y) { };
	Point operator + (Point& p) {
		return Point(p.x + x, p.y + y);
	}
	Point operator - (Point& p) {
		
		return Point(x - p.x, y - p.y);
	}
	Point operator * (double k) {
		return Point(k*x, k*y);
	}
	double abs() {					//向量长度;
		return sqrt(x * x + y * y);
	}
};
typedef Point Vector;
double dot(Vector a, Vector b) {			//内积 x1*x2 + y1*y2
	return a.x * b.x + a.y * b.y;
}
double cross(Vector a, Vector b) {		  //外积  x1*y2 - x2*y1
	return a.x * b.y - a.y * b.x;
}
struct Segment           //线段
{
	Point a, b;
};
typedef Segment Line;   //线段表示直线；
class Circle {
public:
	Point c;
	double r;
	Circle(Point c = Point(), double x = 0) :c(c), r(x) {};
};
void Parallel_Orthogonal() {				//判断平行或正交
	Point a, b,c,d;
	Point e, f;
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a.x >> a.y >> b.x >> b.y>>c.x>>c.y>>d.x>>d.y;
		e = a - b;
		f = c - d;
		if (equals(dot(e, f), 0)) cout << "1" << endl;
		else if (equals(cross(e, f), 0))cout << "2" << endl;
		else cout <<"0" <<endl;
	}
}
Point Projection(Point& a, Point& b, Point& c) {		//计算投影点
	Point p;
	Vector v1 = b - a;
	Vector v2 = c - a;
	double len = dot(v1, v2);
	double len2 = len/ v1.abs();
	p.x = a.x + len2 / v1.abs() * v1.x;
	p.y = a.y + len2 / v1.abs() * v1.y;
	return p;
}
Point Reflection(Point& a, Point& b, Point& c) {	//算映像
	Point p = Projection(a, b, c);					//算出映射点
	return p*2 - c;									//映射点 是 该点与映像点中点  x + c = 2*p；
}
double getDistancePP(Point a, Point b) {				//两点距离;
	return ((a - b).abs());
}
double getDistancePL(Point a, Line b) {			//求点到直线距离 外积 = |a|.|b|.sin0  在直线上取两点，然后以其中一点为端点求出外
	Vector m = b.a - b.b;						//积的大小 再除以直线上的向量大小 则可以求解。
	Vector m2 = a - b.b;
	return cross(m, m2) / m.abs();
}
int ccw(Point a, Point b, Point c) {			//三个点的位置关系
	Vector p = b - a;
	Vector p2 = c - a;
	if (cross(p, p2) > EPS) return COUNTER_CLOCKWISE;		//逆时针方向向外 结果为正
	if (cross(p, p2) < -EPS) return CLOCKWISE;				//顺时针方向为内 结果为负
	if (dot(p, p2) < -EPS) return ONLINE_BACK;
	if (dot(p, p2) > EPS&& p2.abs() > p.abs()) return ONLINE_FRONT;
	return ON_SEGMENT;
}
double getDistancePS(Point a, Segment b) {		//点到线段的距离;
	Point p1, p2;
	p1 = a - b.a;
	p2 = b.b - b.a;
	if (dot(p1, p2) < 0) {
		return p1.abs();
	}
	p1 = a - b.b;
	p2 = b.a - b.b;
	if (dot(p1, p2) < 0) {
		return p1.abs();
	}
	else {
		return getDistancePL(a, b);
	}
}

//double Distance(Segment a, Segment b) {             //计算两线段距离
// 
//}
int main(void) {				
	Point a, b, c;
	string m[5];
	m[ON_SEGMENT] = "ON_SEGMENT";
	m[COUNTER_CLOCKWISE] = "COUNTER_CLOCKWISE";
	m[CLOCKWISE] = "CLOCKWISE";
	m[ONLINE_BACK] = "ONLINE_BACK";
	m[ONLINE_FRONT] = "ONLINE_FRONT";
	cin >> a.x >> a.y >> b.x >> b.y;
	int n;
	cin >> n;
	int key = 0;
	for (int i = 0; i < n; i++) {
		cin >> c.x >> c.y;
		key = ccw(a, b, c);
		cout << m[key] << endl;
	}
}


Measured memory_bytes: 3284