#include<iostream>
#define for1(i, n) for(int i = 1; i <= (n);i++)
using namespace std;
int q;
signed main() {
	double x1, x2, x3, y1, y2, y3;
	cin >> x1 >> y1 >> x2 >> y2 >> q;
	for1(i, q) {
		cin >> x3 >> y3;
		if ((x1 - x2) * (y3 - y1) == (y1 - y2) * (x3 - x1)) {
			if ((x1 - x2) * (x1 - x3) < 0 || (y1 - y2) * (y1 - y3) < 0)cout << "ONLINE_BACK\n";
			else if ((x2 - x1) * (x2 - x3) < 0 || (y2 - y1) * (y2 - y3) < 0)cout << "ONLINE_FRONT\n";
			else cout << "ON_SEGMENT\n";
		}
		else cout << ((x1 - x2) * (y3 - y1) < (y1 - y2) * (x3 - x1) ? "COUNTER_C" : "C") << "LOCKWISE\n";
	}
}
