#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))

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

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

