#include <bits/stdc++.h>
using namespace std;

struct F {
	long long a, b;
	F() {}
	F(long long _a, long long _b) : a(_a), b(_b) {}
	F operator + (const F &f) {
		long long x = a * f.a, y = b * f.a + a * f.b;
		long long g = __gcd(x, y);
		return F(x / g, y / g);
	}
	F operator - (const F &f) {
		long long x = a * f.a, y = b * f.a - a * f.b;
		long long g = __gcd(x, y);
		return F(x / g, y / g);
	}
	F operator * (const F &f) {
		long long x = a * f.a, y = b * f.b;
		long long g = __gcd(x, y);
		return F(x / g, y / g);
	}
	F operator / (const F &f) {
		long long x = a * f.b, y = b * f.a;
		long long g = __gcd(x, y);
		return F(x / g, y / g);
	}
};
const double pi = acos(-1);
const double eps = 1e-8;
inline int sign(double a) {
	return a < -eps ? -1 : a > eps;
}
inline int cmp(double a, double b) {
	return sign(a - b);
}
double add(double a, double b) {
	if (abs(a + b) < eps * (abs(a) + abs(b))) return 0;
	return a + b;
}
typedef long long data;
struct P {
	data x, y;
	P() {}
	P(data x, data y) : x(x), y(y) {}
	P operator + (const P &p) { return P(add(x, p.x), add(y, p.y)); }
	P operator - (const P &p) { return P(add(x, -p.x), add(y, -p.y)); }
	P operator * (data d) { return P(x * d, y * d); }
	P operator / (data d) { return P(x / d, y / d); }
	data dot(const P &p) { return add(x * p.x, y * p.y); }
	data det(const P &p) { return add(x * p.y, -y * p.x); }
	data alpha() { return atan2(y, x); }
	data abs() { return sqrt(abs2()); }
	data abs2() { return x * x + y * y; }
	P rot90() { P(-y, x); }
	P unit() { return *this / abs(); }
	bool operator < (P p) const {
		int c = cmp(x, p.x);
		if (c) return c == -1;
		return cmp(y, p.y) == -1;
	}
	friend istream& operator>>(istream &in, P &p) {
		in >> p.x >> p.y;
		return in;
	}
	friend ostream& operator<<(ostream& out, P &p) {
		out << p.x << ' ' << p.y;
		return out;
	}
};
P projection(P p1, P p2, P q) {
	P dir = p2 - p1;
	return p1 + dir * (dir.dot(q - p1) / dir.abs2());
}
P reflection(P p1, P p2, P q) {
	return projection(p1, p2, q) * 2 - q;
}
double dist(const P &a, const P &b) {
	double x = a.x - b.x, y = a.y - b.y;
	return sqrt(add(x * x,  y * y));
}
bool on_seg(P p1, P p2, P q) {
	return (p1 - q).det(p2 - q) == 0 && (p1 - q).dot(p2 - q) <= 0;
}
P intersection(P p1, P p2, P q1, P q2) {
	return p1 + (p2 - p1) * ((q2 - q1).det(q1 - p1) / (q2 - q1).det(p2 - p1));
}

int main() {
#ifdef LOCAL_DEFINE
	//freopen("data.in", "rt", stdin);
	//freopen("data.out", "w", stdout);
	auto _start = chrono::high_resolution_clock::now();
#endif

	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	P p0, p1;
	cin >> p0 >> p1;
	int q;
	cin >> q;
	P v1 = p1 - p0;
	while (q--) {
		P p2;
		cin >> p2;
		P v2 = p2 - p0;
		if(v1.det(v2) > 0) {
			cout << "COUNTER_CLOCKWISE\n";
		} else if(v1.det(v2) < 0) {
			cout << "CLOCKWISE\n";
		} else {
			if(v1.dot(v2) < 0) {
				cout << "ONLINE_BACK\n";
			} else if((p0 - p1).dot(p2 - p1) < 0) {
				cout << "ONLINE_FRONT\n";	
			} else if((p0 - p2).dot(p1 - p2) <= 0) {
				cout << "ON_SEGMENT\n";
			}
		}
	}

#ifdef LOCAL_DEFINE
	auto _end = chrono::high_resolution_clock::now();
	cerr << "elapsed time: " << chrono::duration<double, milli>(_end - _start).count() << " ms\n";
#endif
	return 0;
}


Measured memory_bytes: 3224