// ConsoleApplication.cpp : コンソール アプリケーションのエントリ ポイントを定義します。
//

#include "stdio.h"
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <string>

using namespace std;
using NUM = long double;

template<typename T>
struct Point {
	T x, y;
	Point<T> operator+(const Point<T>& rhs)const {
		Point<T> p;
		p.x = this->x + rhs.x;
		p.y = this->y + rhs.y;
		return p;
	}
	Point<T> operator-(const Point<T>& rhs)const {
		Point<T> p;
		p.x = this->x - rhs.x;
		p.y = this->y - rhs.y;
		return p;
	}
	Point<T> operator*(const T rhs) const {
		Point<T> p;
		p.x = this->x * rhs;
		p.y = this->y * rhs;
		return p;
	}
	Point<T> operator-() const {
		Point<T> p;
		p.x = this->x * -1.0;
		p.y = this->y * -1.0;
		return p;
	}
};

template<typename T>
Point<T> operator*(const T val, const Point<T>& p)
{
	return p*val;
}

template<typename T>
struct Segment {
	Point<T> p1, p2;
};

template<typename T>
bool isZero(const T val)
{
	return fabs(val) < 1e-10;
}

template<typename T>
T innerProduct(const Point<T>& p0, const Point<T>& p1)
{
	double x0 = p0.x;
	double y0 = p0.y;
	double x1 = p1.x;
	double y1 = p1.y;
	return x0 * x1 + y0 * y1;
}

template<typename T>
T outerProduct(const Point<T>& p0, const Point<T>& p1)
{
	double x0 = p0.x;
	double y0 = p0.y;
	double x1 = p1.x;
	double y1 = p1.y;
	return x0 * y1 - y0 * x1;
}

template<typename T>
T norm(const Point<T>& p)
{
	double x = p.x;
	double y = p.y;
	return x*x + y*y;
}

template<typename T>
T absolute(const Point<T>& p)
{
	return sqrt(norm(p));
}

template<typename T>
void readPoint(Point<T>& p)
{
	cin >> p.x;
	cin >> p.y;
}

template<typename T>
void readSegment(Segment<T>& s)
{
	cin >> s.p1.x;
	cin >> s.p1.y;
	cin >> s.p2.x;
	cin >> s.p2.y;
}

//template<typename T>
//void outputComponentesOfPoint(const Point<T>& p)
//{
//	cout << fixed;
//	cout << setprecision(8) << p.x;
//	cout << " ";
//	cout << setprecision(8) << p.y;
//	cout << endl;
//}

//template<typename T>
//T getDistanceFromPointToLine(const Segment<T>& s, const Point<T>& p) {
//	const Point<T> a = p - s.p1;
//	const Point<T> b = s.p2 - s.p1;
//	const Point<T> outer = outerProduct(a, b);
//	return outer / absolute(b);
//}

//template<typename T>
//T distance(const Point<T>& p1, const Point<T>& p2)
//{
//	return absolute(p2 - p1);
//}
//
//template<typename T>
//T getDistanceFromPointToSegment(const Point<T>& p, const Segment<T>& s) {
//	const T zero = static_cast<T>(0);
//	const Point<T> a = p - s.p1;//本当は使いまわせる
//	const Point<T> b = s.p2 - s.p1;
//	const Point<T> c = p - s.p2;
//	const T innerAB = innerProduct(a, b);
//	const T innerc_b = innerProduct(c, -b);
//
//	T aaa = distance(p, s.p1);
//	T bbb = distance(p, s.p2);
//	T ccc = fabs(outerProduct(a, b) / absolute(b));
//	if (innerAB < zero) {
//		return distance(p, s.p1);
//	}
//	else if (innerc_b < zero) {
//		return distance(p, s.p2);
//	}
//	else {
//		return fabs(outerProduct(a, b) / absolute(b) );
//	}
//}
//
//template<typename T>
//bool intersects(const Segment<T>& s1, const Segment<T>& s2) {
//	function<bool(Segment<T>, Segment<T>)> intersectsFromOneSegment//one segment : s1
//		= [&](const Segment<T>& s1, const Segment<T>& s2){
//			const Point<T> a = s2.p1 - s1.p1;
//			const Point<T> c = s2.p2 - s1.p1;
//			const Point<T> b = s1.p2 - s1.p1;
//			
//			return outerProduct(b, a) > 0 != outerProduct(b, c) > 0;
//	};
//	return intersectsFromOneSegment(s1, s2) && intersectsFromOneSegment(s2, s1);
//}
//
//template<typename T>
//T getDistanceFromSegmentToSegment(const Segment<T>& s1, const Segment<T>& s2) {
//	if (intersects(s1, s2)) {
//		return static_cast<T>(0.0);
//	}else{
//		return min(
//			min(getDistanceFromPointToSegment(s1.p1, s2), getDistanceFromPointToSegment(s1.p2, s2))
//			, min(getDistanceFromPointToSegment(s2.p1, s1), getDistanceFromPointToSegment(s2.p2, s1))
//		);
//	}
//}

//template<typename T>
//void projectPointToSegment(const Point<T>& p, const Segment<T>& s, Point<T>& foot, T& param )
//{
//	const Point<T> a = p - s.p1;
//	const Point<T> b = s.p2 - s.p1;
//	const T normB = norm(b);
//	const T ab = innerProduct(a, b);
//	param = ab / normB;
//	foot = s.p1 + (s.p2 - s.p1)*param;
//}

//template<typename T>
//double getParameterOfProjectedPointToSegment(const Point<T>& p, const Segment<T>& s)
//{
//	const Point<T> a = p - s.p1;
//	const Point<T> b = s.p2 - s.p1;
//	const T normB = norm(b);
//	const T ab = innerProduct(a, b);
//	return param = ab / normB;
//}

int main()
{
	Segment<NUM> s;
	readSegment(s);
	int q; cin >> q;
	for (int i = 0; i != q; ++i) {
		Point<NUM> p2;
		readPoint(p2);
		const Point<NUM> a = s.p2 - s.p1;
		const Point<NUM> b = p2 - s.p1;
		
		const NUM outer = outerProduct(a, b);
		string message;
		if ( !isZero(outer)) {
			message = outer > 0.0 ? "COUNTER_CLOCKWISE" : "CLOCKWISE";
		}
		else {//online
			const NUM normA = norm(a);
			const NUM ab = innerProduct(a, b);
			const NUM positionOfP2 = ab / normA;
			if (positionOfP2 < 0.0) {
					message = "ONLINE_BACK";
			}
			else if (positionOfP2 > 1.0) {
				message = "ONLINE_FRONT";
			}
			else {
				message = "ON_SEGMENT";
			}
		}
		cout << message << endl;
	}


	return 0;
}


Measured memory_bytes: 3280