#include <iostream>
#include <complex>
#include <cstdio>
using namespace std;
typedef complex<double> P;
#define X real()
#define Y imag()
#define EPS (1e-10)

double dot(P a, P b){
  return a.X * b.X + a.Y * b.Y;
}
double cross(P a, P b){
  return a.X * b.Y - a.Y * b.X;
}
  
int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if( cross(b,c) > EPS ) return +1;
  if( cross(b,c) < -EPS ) return -1;
  if( dot(b,c) < 0 ) return +2;
  if( abs(b-a) + EPS < abs(c-a) ) return -2;
  return 0;
}

int main(){
  P p1, p2;
  double x1, x2, y1, y2;
  cin >> x1 >> y1 >> x2 >> y2;
  p1 = P(x1,y1);
  p2 = P(x2,y2);
  int q;
  cin >> q;
  for(int i = 0; i < q; ++i){
    P p;
    cin >> x1 >> y1;
    p = P(x1,y1);
    int t = ccw(p1,p2,p);
    if (t == 1) cout << "COUNTER_CLOCKWISE" << endl;
    else if (t == -1) cout << "CLOCKWISE" << endl;
    else if (t == 2) cout << "ONLINE_BACK" << endl;
    else if (t == -2) cout << "ONLINE_FRONT" << endl;
    else cout << "ON_SEGMENT" << endl;
  }
  return 0;
}