#include<iostream>
#include<iomanip>
#include<algorithm>
#include<fstream>
#define _USE_MATH_DEFINES
#include<math.h>
#define EPS (1e-5)
#define equals(a, b) (fabs((a) - (b)) < EPS )
//#define cout fout
//#define cin fin
using namespace std;

class Point {
public:
	double x, y;

	Point(double x = 0, double y = 0) :x(x), y(y) {}
	Point operator + (Point p) {
		return Point(x + p.x, y + p.y); 
	}
	Point operator - (Point p) {
		return Point(x - p.x, y - p.y);
	}
	Point operator * (double a) {
		return Point(a * x, a * y);
	}
	Point operator / (double a) {
		return Point(x / a, y / a);
	}

	double abs() {
		return sqrt(norm());
	}
	double norm() {
		return x * x + y * y;
	}

	bool operator < (const Point &p)const {
		return x != p.x ? x < p.x : y < p.y;
	}

	bool operator == (const Point &p)const {
		return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
	}
};

typedef Point Vector;

#ifdef cin
ifstream fin("CGL_1_C-in29.txt");
#endif

#ifdef cout
ofstream fout("out.txt");
#endif

double dot(Vector a, Vector b);
double cross(Vector a, Vector b);
double getDistanceSP(Point p, Point p1, Point p2);
double angle(Vector a, Vector b);
bool doIntersect(Point p1, Point p2, Point p3, Point p4);
double getDistanceSS(Point p1, Point p2, Point p3, Point p4);
void clockwise(Point p0, Point p1, Point p2);

int main() {
    int i, q;
	double x0, x1, x2, y0, y1, y2;
	
	cin >> x0 >> y0 >> x1 >> y1;
	Point p0(x0, y0), p1(x1, y1);
	cin >> q;
	for (i = 0; i < q; i++) {
		cin >> x2 >> y2;
		Point p2(x2, y2);
		clockwise(p0, p1, p2);
	}
#ifdef cin
	fin.close();
#endif

#ifdef cout
	fout.close();
#endif
	return 0;
}

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 - a.y * b.x;
}

double getDistanceSP(Point p, Point p1, Point p2) {
	if (dot(p - p1, p2 - p1) < 0.0)return (p - p1).abs();
	else if (dot(p - p2, p1 - p2) < 0.0)return (p - p2).abs();
	else return  fabs(cross(p2 - p1, p - p1)) / (p2 - p1).abs();
}


double angle(Vector a, Vector b) {
	if (equals(dot(a, b), a.abs() * b.abs()))return 0.0;
	else if (equals(dot(a, b), (-1) * a.abs() * b.abs()))return M_PI;
	if (cross(a, b) > 0.0)return acos(dot(a, b) / a.abs() / b.abs());
	else return (-1) * acos(dot(a, b) / a.abs() / b.abs());
}

bool doIntersect(Point p1, Point p2, Point p3, Point p4) {
	if ((equals(fabs(angle(p2 - p1, p4 - p1)), 0) || equals(fabs(angle(p2 - p1, p4 - p1)), M_PI)) && (equals(fabs(angle(p2 - p1, p3 - p1)), 0) || equals(fabs(angle(p2 - p1, p3 - p1)), M_PI)))return false;
	else if (angle(p3 - p1, p4 - p1) >= angle(p3 - p1, p2 - p1) && angle(p3 - p1, p2 - p1) >= 0.0 && angle(p2 - p3, p1 - p3) >= angle(p2 - p3, p4 - p3) && angle(p2 - p3, p4 - p3) >= 0.0)return true;
	else if (angle(p3 - p2, p4 - p2) >= angle(p3 - p2, p1 - p2) && angle(p3 - p2, p1 - p2) >= 0.0 && angle(p1 - p3, p2 - p3) >= angle(p1 - p3, p4 - p3) && angle(p1 - p3, p4 - p3) >= 0.0)return true;
	else return false;
}

double getDistanceSS(Point p1, Point p2, Point p3, Point p4) {
	if (doIntersect(p1, p2, p3, p4))return 0;
	else return min({ getDistanceSP(p4, p1, p2), getDistanceSP(p3, p1, p2), getDistanceSP(p1, p3, p4), getDistanceSP(p2, p3, p4) });
}

void clockwise(Point p0, Point p1, Point p2) {
	if (p2 == p0 || p2 == p1) {
		cout << "ON_SEGMENT" << endl;
	} else if (angle(p1 - p0, p2 - p0) == 0.0) {
		if((p1 - p0).norm() < (p2 - p0).norm())cout << "ONLINE_FRONT" << endl;
		else cout << "ON_SEGMENT" << endl;
	} else if(angle(p1 - p0, p2 - p0) == M_PI){
		cout << "ONLINE_BACK" << endl;
	} else {
		if(angle(p1 - p0, p2 - p0) > 0.0)cout << "COUNTER_CLOCKWISE" << endl;
		else cout << "CLOCKWISE" << endl;
	}
}

Measured memory_bytes: 3532