#include <stdio.h>
#include <math.h>
#define y1 y11111

double x1,y1,x2,y2;
int main(){
	scanf("%lf%lf%lf%lf",&x1,&y1,&x2,&y2);
	x2-=x1;
	y2-=y1;
	int q;
	scanf("%d",&q);
	while(q--){
		double x,y;
		scanf("%lf%lf",&x,&y);
		x-=x1;
		y-=y1;
		int c=x2*y-y2*x;
		if(c>0)puts("COUNTER_CLOCKWISE");
		else if(c<0)puts("CLOCKWISE");
		else{
			int r=x*x2+y*y2;
			if(r<0)puts("ONLINE_BACK");
			else if(r>x2*x2+y2*y2)puts("ONLINE_FRONT");
			else puts("ON_SEGMENT");
		}
	}
}
