#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
using namespace std;
#define EPS (1e-10)
#define equals(a, b) (fabs(a - b) < EPS)

class Point{
public:
  double x, y;

  Point(double x = 0, double y = 0) : x(x), y(y) {}

  Point operator + (Point p){return Point(x + p.x, y + p.y);}
  Point operator - (Point p){return Point(x - p.x, y - p.y);}
  Point operator * (double a){return Point(x * a, y * a);}
  Point operator / (double a){return Point(x / a, y / a);}

  double abs(){return sqrt(norm());}
  double norm(){return x * x + y * y;}

  bool operator < (const Point &p) const{
    return x != p.x ? x < p.x : y < p.y;
  }
  bool operator == (const Point &p) const{
    return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
  }

};

typedef Point Vector;

class Segment{
public:
  Point p1, p2;
  Segment(Point p1, Point p2): p1(p1), p2(p2){}
};

typedef Segment Line;

class Circle{
public:
  Point c;
  double r;
  Circle(Point c = Point(), double r = 0): c(c), r(r){}
};

typedef vector<Point> Polygon;

double dot(Vector a, Vector b){
  return a.x * b.x + a.y * b.y;
}
double cross(Vector a, Vector b){
  return a.x * b.y - a.y * b.x;
}

Point reflect(Point p0, Point p1, Point p2){
  Vector v01 = Vector(p0.x - p1.x, p0.y - p1.y);
  Vector v21 = Vector(p2.x - p1.x, p2.y - p1.y);
  double t = -1 * ((p2.x - p1.x) * (p1.x - p0.x) + (p2.y - p1.y) * (p1.y - p0.y)) / (pow(p2.x - p1.x, 2) + pow(p2.y - p1.y, 2));
  return (v21 * t - v01) * 2 + p0;
}

Point project(Point p0, Point p1, Point p2){
  Vector v01 = Vector(p0.x - p1.x, p0.y - p1.y);
  Vector v21 = Vector(p2.x - p1.x, p2.y - p1.y);
  double t = -1 * ((p2.x - p1.x) * (p1.x - p0.x) + (p2.y - p1.y) * (p1.y - p0.y)) / (pow(p2.x - p1.x, 2) + pow(p2.y - p1.y, 2));
  return v21 * t + p1;
}

double dis(Point p1, Point p2){
  return (p1 - p2).abs();
}

double getdis(Segment s, Point p){
  if(dot(s.p2 - s.p1, p - s.p1) < 0) return dis(s.p1, p);
  if(dot(s.p1 - s.p2, p - s.p2) < 0) return dis(s.p2, p);
  return dis(project(p, s.p1, s.p2), p);
}

/*void solve(){
  int q; cin >> q;
  vector<double> ans(q);
  for(int i = 0; i < q; i++){
    double x[4], y[4];
    Point p[4];
    for(int j = 0; j < 4; j++){
      cin >> x[j] >> y[j];
      p[j] = Point(x[j], y[j]);
    }
    Segment s01 = Segment(p[0], p[1]);
    Segment s23 = Segment(p[2], p[3]);
    if(intersect(s01, s23)){
      ans[i] = 0;
      continue;
    }
    ans[i] = 10000000;
    for(int j = 0; j < 4; j++){
      if(j < 2) ans[i] = min(getdis(s23, p[j]), ans[i]);
      else ans[i] = min(getdis(s01, p[j]), ans[i]);
    }
  }
  for(int i = 0; i < q; i++){
    cout << fixed << setprecision(10) << ans[i] << endl;
  }
  return;
}*/

void solve2(){
  double x[3], y[3];
  Point p[3];
  for(int i = 0; i < 2; i++){
    cin >> x[i] >> y[i];
    p[i] = Point(x[i], y[i]);
  }
  int q; cin >> q;
  vector<string> ans(q);
  for(int i = 0; i < q; i++){
    cin >> x[2] >> y[2];
    p[2] = Point(x[2], y[2]);
    Vector v01 = Vector(x[1] - x[0], y[1] - y[0]);
    Vector v02 = Vector(x[2] - x[0], y[2] - y[0]);
    if(equals(cross(v01, v02), 0)){
      if(dot(v01, v02) < 0) ans[i] = "ONLINE_BACK";
      else if(equals(v01.abs(), v02.abs()) == true || v01.abs() > v02.abs()) ans[i] = "ON_SEGMENT";
      else ans[i] = "ONLINE_FRONT";
    }
    else if(cross(v01, v02) > 0) ans[i] = "COUNTER_CLOCKWISE";
    else ans[i] = "CLOCKWISE";
  }
  for(int i = 0; i < q; i++){
    cout << ans[i] << endl;
  }
  return;
}

int main(){
  solve2();
  return 0;
}



Measured memory_bytes: 3324