import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); } bool DEBUG = 0; 
void log(A ...)(lazy A a){ if(DEBUG) print(a); }
void print(){ writeln(""); } void print(T)(T t){ writeln(t); } void print(T, A ...)(T t, A a){ write(t, " "), print(a); }
string unsplit(T)(T xs){ return xs.array.to!(string[]).join(" "); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; } T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
T lowerTo(T)(ref T x, T y){ if(x > y) x = y; return x; } T raiseTo(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	long x0 = scan!long, y0 = scan!long, x1 = scan!long, y1 = scan!long;
	Vector v1 = Vector(x1 - x0, y1 - y0);
	int q = scan!int;
	foreach(_; 0 .. q){
		Vector v2 = Vector(scan!long - x0, scan!long - y0);
		string ans;
		if(v2.square == 0) ans = "ON_SEGMENT";
		else if(v2.arg == v1.arg){
			if(v2.square > v1.square) ans = "ONLINE_FRONT";
			else ans = "ON_SEGMENT";
		}
		else if(v2.arg == -v1.arg) ans = "ONLINE_BACK";
		else if(v2.isLeftTo(v1)) ans = "COUNTER_CLOCKWISE";
		else ans = "CLOCKWISE";
		
		ans.print;
	}
}

struct Vector{
    long x, y;
    Argument arg;
    long square;
    real length;
    this(long x, long y){
        this.x = x, this.y = y;
        if(x != 0 || y != 0) arg = Argument(x, y);
        square = x * x + y * y;
        length = square.to!real.sqrt;
    }
    bool opEquals(Vector v){
        return x == v.x && y == v.y;
    }
	Vector opUnary(string s)(){
		if(s == "+") return Vector(x, y);
		if(s == "-") return Vector(-x, -y);
		assert(0, "Operator unary " ~ s ~ " not implemented");
	}
	Vector opBinary(string s)(Vector v){
		if(s == "+") return Vector(x + v.x, y + v.y);
		if(s == "-") return Vector(x - v.x, y - v.y);
		assert(0, "Operator " ~ s ~ " not implemented");
	}
    Vector opBinary(string s)(long k){
        if(s == "*") return Vector(x * k, y * k);
		assert(0, "Operator " ~ s ~ " not implemented");
    }
    Vector opBinaryRight(string s)(long k){
        if(s == "*") return Vector(k * x, k * y);
		assert(0, "Operator " ~ s ~ " not implemented");
    }

    int quadrant(){ return arg.quadrant; }
    bool isLeftTo(Vector v){ return arg.isLeftTo(v.arg); }
    bool follows(Vector v){ return arg.follows(v.arg); }
}
struct Argument{
    long x, y;
    this(long x, long y){
        assert(x != 0 || y != 0);
        this.x = x, this.y = y;
    }
    
    bool opEquals(Argument a){
        return quadrant == a.quadrant && y * a.x == x * a.y;
    }
	Argument opUnary(string s)(){
		if(s == "+") return Argument(x, y);
		if(s == "-") return Argument(-x, -y);
		assert(0, "Operator unary " ~ s ~ " not implemented");
	}
	Argument opBinary(string s)(Argument a){
		if(s == "+") return Argument(x * a.x - y * a.y, y * a.x + x * a.y);
		if(s == "-") return Argument(x * a.x + y * a.y, y * a.x - x * a.y);
		assert(0, "Operator " ~ s ~ " not implemented");
	}

    // 象限
    // (1, 0) ≦ this ＜ (0, 1) のとき 1　など
    int quadrant(){
        if(x > 0 && y >= 0) return 1;
        if(x <= 0 && y > 0) return 2;
        if(x < 0 && y <= 0) return 3;
        if(x >= 0 && y < 0) return 4;
        assert(0);
    }

    // a から見て this は左側である（aと平行は含まない）
    bool isLeftTo(Argument a){
        return y * a.x - x * a.y > 0;
    }

    // (1, 0) から反時計回りに見て this < a である
    bool follows(Argument a){
        int q = this.quadrant, aq = a.quadrant;
        if(q != aq) return q < aq;
        else return a.isLeftTo(this);
    }
}

