#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<cmath>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define PII pair<int,int>
#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

class Point
{
public:
	double x, y;
	Point(double X = 0, double 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 *(const double a)const { return Point(x*a, y*a); };
	Point operator /(const double a)const { return Point(x / a, y / a); };
	double norm()const { return x*x + y*y; };
	double length()const { return sqrt(norm()); };
	double dot(const Point &p)const { return x*p.x + y*p.y; };
	double cross(const Point &p)const { return x*p.y - y*p.x; };
	bool operator ==(const Point &p)const
	{
		return fabs(x - p.x)<EPS &&fabs(y - p.y)<EPS;
	}
	friend ostream& operator <<(ostream& os, const Point &p);
	int CCW(Point p1, Point p2)
	{
		Point p0(x, y);
		Point V1 = p1 - p0;
		Point V2 = p2 - p0;
		if (V1.cross(V2) > 0.0)return 0;
		else if (V1.cross(V2) < 0.0)return 1;
		else if (V1.dot(V2) < 0.0)return 2;
		else if (V1.norm() < V2.norm())return 3;
		return 4;
	}
};
typedef Point Vector;

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

class Segment
{
public:
	Point p1, p2;
	Segment(double x1, double y1, double x2, double y2)
	{
		p1.x = x1;
		p1.y = y1;
		p2.x = x2;
		p2.y = y2;
	}
	double GetLength()
	{
		Point temp = p2 - p1;
		return temp.length();
	}
	double GetDistanceSeg(double X, double Y)
	{
		Point p(X, Y);
		Point a = p2 - p1;
		Point b = p - p1;
		Point c = p1 - p2;
		Point d = p - p2;
		if (a.dot(b) < 0.0)return b.length();
		if (c.dot(d) < 0.0)return d.length();
		return GetDistanceLine(X, Y);
	}
	double GetDistanceLine(double X, double Y)
	{
		Point t(X, Y);
		Point a = p2 - p1;
		Point b = t - p1;
		return abs(a.cross(b) / a.length());
	}
	bool IsIntersect(const Segment &s)
	{

	}
	bool IsOrthogonal(const Segment &s)
	{
		Vector t1 = p2 - p1;
		Vector t2 = s.p2 - s.p1;
		return equals(0.0, t1.dot(t2));
	}
	bool IsParallel(const Segment &s)
	{
		Vector t1 = p2 - p1;
		Vector t2 = s.p2 - s.p1;
		return equals(0.0, t1.cross(t2));
	}
	Point GetProjection(double X, double Y)const
	{
		Vector V = p2 - p1;
		Point P(X, Y);
		Point ret = V*(V.dot(P - p1) / V.norm());
		return ret + p1;
	}
	Point GetReflect(double X, double Y)
	{
		Point t(X, Y);
		Point Pro = GetProjection(X, Y);
		Vector dV = Pro - t;
		return t + dV*2.0;
	}


};
typedef Segment Line;

class Circle
{
public:
	Point c;
	double r;
	Circle(Point C = Point(), double R = 0)
	{
		c = C;
		r = R;
	}
};

int main()
{
	int x0, y0, x1, y1;
	cin >> x0 >> y0 >> x1 >> y1;
	Point p0(x0, y0), p1(x1, y1);
	int q;
	cin >> q;
	REP(i, q)
	{
		string str;
		int x2, y2;
		cin >> x2 >> y2;
		Point p2(x2, y2);
		int res=p0.CCW(p1, p2);
		switch (res)
		{
		case 0:
			str = "COUNTER_CLOCKWISE";
			break;
		case 1:
			str = "CLOCKWISE";
			break;
		case 2:
			str = "ONLINE_BACK";
			break;
		case 3:
			str = "ONLINE_FRONT";
			break;
		case 4:
			str = "ON_SEGMENT";
			break;
		}
		cout << str << endl;
	}
	return 0;
}

Measured memory_bytes: 3192