#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
#define equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
//const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

class Point {
public:
  ld x, y;

  Point() {}
  Point(ld x, ld y): x(x), y(y) {}

  Point operator + (const Point &p) {
    return Point(x + p.x, y + p.y);
  }
  Point operator - (const Point &p) {
    return Point(x - p.x, y - p.y);
  }
  Point operator * (const ld k) {
    return Point(x * k, y * k);
  }
  Point operator / (const ld k) {
    return Point(x / k, y / k);
  }
  Point operator += (const Point &p) {
    x += p.x;
    y += p.y;
    return *this;
  }
  Point operator -= (const Point &p) {
    x -= p.x;
    y -= p.y;
    return *this;
  }
  Point operator *= (const ld k) {
    x *= k;
    y *= k;
    return *this;
  }
  Point operator /= (const ld k) {
    x /= k;
    y /= k;
    return *this;
  }
  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }
  bool operator == (const Point &p) const {
    return equals(x, p.x) && equals(y, p.y);
  }
  friend ostream& operator << (ostream &os, const Point &p) {
    os << p.x << ' ' << p.y;
    return os;
  }
  friend istream& operator >> (istream &is, Point &p) {
    ld x, y;
    is >> x >> y;
    p = Point(x, y);
    return is;
  }

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

ld dot(Point a, Point b) {
  return a.x * b.x + a.y * b.y;
}

ld cross(Point a, Point b) {
  return a.x * b.y - a.y * b.x;
}

class Segment {
public:
  Point p1, p2;

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

//線分sに対する点pの射影
Point project(Segment s, Point p) {
  Point base = s.p2 - s.p1;
  ld r = dot(p - s.p1, base) / base.norm();
  return s.p1 + base * r;
}

//線分sを対称軸とした点pの線対象の点
Point reflect(Segment s, Point p) {
  return p + (project(s, p) - p) * 2;
}

//反時計回り:1
//時計回り:-1
//p2, p0, p1:2
//p0, p1, p2:-2
//p0, p2, p1:0
int ccw(Point p0, Point p1, Point p2) {
  Point a = p1 - p0;
  Point b = p2 - p0;
  if (cross(a, b) > EPS) return 1;
  if (cross(a, b) < -EPS) return -1;
  if (dot(a, b) < -EPS) return 2;
  if (a.norm() < b.norm()) return -2;
  return 0;
}

//直線lと点pの距離
ld getDistanceLP(Segment l, Point p) {
  return abs(cross(l.p2 - l.p1, p - l.p1) / (l.p2 - l.p1).abs());
}

//線分sと点pの距離
ld getDistanceSP(Segment s, Point p) {
  if (dot(s.p2 - s.p1, p - s.p1) < 0) return (p - s.p1).abs();
  if (dot(s.p1 - s.p2, p - s.p2) < 0) return (p - s.p2).abs();
  return getDistanceLP(s, p);
}



class Circle {
public:
  Point p;
  ld r;

  Circle() {}
  Circle(Point p, ld r): p(p), r(r) {}
};

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(25);

  Point p[3];
  int q;
  cin >> p[0] >> p[1] >> q;
  while (q--) {
    cin >> p[2];
    int t = ccw(p[0], p[1], p[2]);
    if (t == 1) cout << "COUNTER_CLOCKWISE\n";
    if (t == -1) cout << "CLOCKWISE\n";
    if (t == 2) cout << "ONLINE_BACK\n";
    if (t == -2) cout << "ONLINE_FRONT\n";
    if (t == 0) cout << "ON_SEGMENT\n";
  }


  

  
  return 0;
}


Measured memory_bytes: 3320