#include<bits/stdc++.h>
/*
#include<algolithm>
#include<array>
#include<vector>
*/
using namespace std;

typedef double Real;
constexpr Real EPS = 1e-8;

enum { CCW=1, CW = -1, BACK= 2, FRONT=-2, ON=0};


int sign(Real d) {
	if (d>EPS) { return 1; }
	if (d<-EPS) { return -1; }
	return 0;
}

struct Point {
	Real x,y;

	Point(Real x_=0, Real y_=0): x(x_), y(y_) {}

	Point operator+(const Point &p) const {
		return Point(x+p.x,y+p.y);
	}
	Point operator-(const Point &p) const {
		return Point(x-p.x,y-p.y);
	}
	Point operator*(Real s) const {
		return Point(x*s,y*s);
	}
	Point operator/(Real s) const {
		return Point(x/s,y/s);
	}
	Point operator<(const Point &p) const {
		return sign(x - p.x) == -1 || (sign(x - p.x)==0 && sign(y - p.y)==-1);
	}
	Point operator==(const Point &p) const { return sign(x-p.x) == 0 && sign(y - p.y)==0; }

};

istream &operator>>(istream &is, Point &p) {
	return is >> p.x >> p.y;
}
ostream &operator<<(ostream &os, const Point &p) {
	return os << '(' << p.x << ", " << p.y << ')';
}

struct Line : public array<Point, 2> { //??????
	Line(const Point &a, const Point &b) { at(0) = a; at(1) = b; }
};

struct Segment : public array<Point, 2> { //??´???
	Segment(const Point &a, const Point &b) { at(0) = a; at(1) = b; }
};

struct Circle {
	Point c;
	Real r;
	Circle(const Point &c_, Real r_): c(c_), r(r_) {}
};

typedef vector<Point> Polygon;




//--- solve ---
Point rotate90(const Point &p) { //???????¨???????
	return Point(-p.y,p.x);
}

Point rotate(const Point &p, Real theta) {
	const Real s = sin(theta), c = cos(theta);
	return Point(c*p.x - s*p.y, s*p.x + c*p.y);
}

Real angle(const Point &p) {
	return atan2(p.y, p.x);
}

Real norm(const Point &p) {
	return p.x * p.x + p.y * p.y;
}

Real abs(const Point &p) {
	return sqrt(norm(p));
}

Real dot(const Point &a, const Point &b) { //??????
	return a.x * b.x + a.y * b.y;
}

Real cross(const Point &a, const Point &b) {
	return a.x * b.y - a.y * b.x;
}


Point project(const Line &l, const Point &p) { //?°???±
	const Point a = p - l[0];
	const Point b = l[1] - l[0];
	return l[0] + b * (dot(a,b) / norm(b));
}

bool intersect(const Line &a, const Line &b) { //
	return sign(cross(a[1]-a[0], b[1]-b[0])) != 0
		|| sign(cross(a[1]-a[0], b[1]-a[0])) == 0;
}

Point reflect(const Line &l, const Point &p) { //?°???±
	const Point t = project(l, p);
	return t + (t-p);
}

int ccw(const Point &a, const Point &b, const Point &c) {
	const Point p = b - a;
	const Point q = c - a;
	const Real cr = cross(p,q);

	if (sign(cr) == 1) { return CCW; }
	else if (sign(cr) == -1) { return CW; }
	else if (sign(dot(p,q)) == -1) { return BACK; }
	else if (sign(norm(p) - norm(q)) == -1) { return FRONT; }
	return ON;
}


//CCW=1, CW = -1, BACK= 2, FRONT=-2, ON=0
int main() {
	Point p1,p2;
	int q;
	int x,y;

	cout.setf(ios::fixed);
	cout.precision(10);
	cin >> p1.x >> p1.y >> p2.x >> p2.y;
	cin >> q;
	for(int i=0; i < q; i++) {
		Point p;
		cin >> p.x >> p.y;
		int num = ccw(p1,p2,p);
		switch(num) {
			case CCW:
				cout << "COUNTER_CLOCKWISE" << endl;
				break;
			case CW:
				cout << "CLOCKWISE" << endl;
				break;
			case BACK:
				cout << "ONLINE_BACK" << endl;
				break;
			case FRONT:
				cout << "ONLINE_FRONT" << endl;
				break;
			case ON:
				cout << "ON_SEGMENT" << endl;
				break;
		}

	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1232