#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

typedef struct vector{
  int64 x,y;
} vec;

int64 innerNorm(vec a,vec b){
  return a.x*b.x+a.y*b.y;
}

int64 norm(vec a){
  return a.x*a.x+a.y*a.y;
}

int64 isParallel(vec a,vec b){
  int64 in=innerNorm(a,b);
  int64 x=norm(a);
  int64 y=norm(b);
  return in*in==x*y;
}

void run(void){
  int a,b,c,d;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  vec p;
  p.x=c-a;
  p.y=d-b;
  int query;
  scanf("%d",&query);
  while(query--){
    int x,y;
    scanf("%d%d",&x,&y);
    vec q;
    q.x=x-a;
    q.y=y-b;
    if(isParallel(p,q)){
      if(ABS(p.x+q.x)<ABS(p.x)+ABS(q.x) || ABS(p.y+q.y)<ABS(p.y)+ABS(q.y)){
	printf("ONLINE_BACK\n");
      } else {
	if(norm(p)<norm(q)){
	  printf("ONLINE_FRONT\n");
	} else {
	  printf("ON_SEGMENT\n");
	}
      }
    } else {
      int t=p.x*q.y-p.y*q.x;
      printf("%s\n",t>0?"COUNTER_CLOCKWISE":"CLOCKWISE");
    }
  }
}

int main(void){
  run();
  return 0;
}

