#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>

using namespace std;

#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

map<int, string> ccwMap{
	{ COUNTER_CLOCKWISE, "COUNTER_CLOCKWISE" },
	{ CLOCKWISE, "CLOCKWISE"},
	{ ONLINE_BACK, "ONLINE_BACK"},
	{ ONLINE_FRONT ,"ONLINE_FRONT"},
	{ ON_SEGMENT , "ON_SEGMENT"} 
};

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 * (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 t){ return Point(x * t, y * t); }
	Point operator / (double t){ return Point(x / t, y / t); }


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

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

typedef Point Vector;

class Segment{
public:
	Point p1, p2;
};

typedef Segment Line;

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;
}

bool isOrthogonal(Vector a, Vector b){
	return equals(dot(a, b), 0);
}

bool isOrthogonal(Point a1, Point a2, Point b1, Point b2){
	return isOrthogonal(a1 - a2, b1 - b2);
}

bool isParallel(Vector a, Vector b){
	return equals(cross(a, b), 0);
}

bool isParallel(Point a1, Point a2, Point b1, Point b2){
	return isParallel(a1 - a2, b1 - b2);
}

Point projection(Segment s, Point p){
	Vector v1 = s.p2 - s.p1;
	Vector v2 = p - s.p1;
	return s.p1 + v1 * dot(v1, v2) / v1.norm();
}

Point reflection(Segment s, Point p){
	return p + (projection(s, p) - p) * 2.0;
}

double dist_p_p(Point p1, Point p2){
	return Vector(p1 - p2).abs();
}

double dist_p_l(Line l, Point p){
	Vector v1 = p - l.p1;
	Vector v2 = l.p2 - l.p1;
	return cross(v1, v2) / v2.abs();
}

double dist_p_s(Segment s, Point p){
	if (dot(p - s.p1, s.p2 - s.p1) < EPS) return (p - s.p1).abs();
	if (dot(p - s.p2, s.p1 - s.p2) < EPS) return (p - s.p2).abs();
	return dist_p_l(s, p);
}

/*
static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;
*/

int ccw(Point p0, Point p1, Point p2){
	Vector v1 = p1 - p0;
	Vector v2 = p2 - p0;
	double c = cross(v1, v2);
	if (c > EPS) return COUNTER_CLOCKWISE;
	if (c < -EPS) return CLOCKWISE;
	double d = dot(v1, v2);
	if (d < -EPS) return ONLINE_BACK;
	if (v1.norm() < v2.norm()) return ONLINE_FRONT;
	return ON_SEGMENT;
}

double dist_s_s(Segment s1, Segment s2){
	return 0;
}

int main()
{
	std::ios_base::sync_with_stdio(false);
	cout.precision(20);

	Point p0, p1;
	cin >> p0.x >> p0.y >> p1.x >> p1.y;

	int q; cin >> q;
	for (int i = 0; i < q; ++i){
		Point p2; cin >> p2.x >> p2.y;
		int res = ccw(p0, p1, p2);
		cout << ccwMap[res] << endl;
	}
}

Measured memory_bytes: 3296