import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int readint() {
    return readln.chomp.to!int;
}

int[] readints() {
    return readln.split.map!(to!int).array;
}

string calc(Vec2 p0, Vec2 p1, Vec2 p2) {
    auto p01 = p1 - p0;
    auto p02 = p2 - p0;

    auto d = p01.cross(p02);
    if (d > 0)
        return "COUNTER_CLOCKWISE";
    if (d < 0)
        return "CLOCKWISE";

    // |p01||p02|cos(pi) ??§ cos(pi) = -1 ????????§??????????????????
    if (p01.dot(p02) < 0)
        return "ONLINE_BACK";

    if (p01.magSq() >= p02.magSq())
        return "ON_SEGMENT";
    return "ONLINE_FRONT";
}

void main() {
    auto xs = readints();
    auto p0 = Vec2(xs[0], xs[1]);
    auto p1 = Vec2(xs[2], xs[3]);

    int q = readint();
    for (int i = 0; i < q; i++) {
        auto xy = readints();
        auto p2 = Vec2(xy[0], xy[1]);
        auto ans = calc(p0, p1, p2);
        writeln(ans);
    }
}

struct Vec2 {
    immutable double x;
    immutable double y;

    this(double x, double y) {
        this.x = x;
        this.y = y;
    }

    Vec2 opAdd(Vec2 other) {
        return Vec2(this.x + other.x, this.y + other.y);
    }

    Vec2 opSub(Vec2 other) {
        return Vec2(this.x - other.x, this.y - other.y);
    }

    Vec2 opMul(double d) {
        return Vec2(this.x * d, this.y * d);
    }

    double dot(Vec2 other) {
        return this.x * other.x + this.y * other.y;
    }

    double cross(Vec2 other) {
        return this.x * other.y - other.x * this.y;
    }

    double mag() {
        return sqrt(magSq());
    }

    double magSq() {
        return this.x * this.x + this.y * this.y;
    }

    Vec2 normalize() {
        auto m = mag();
        if (m != 0 && m != 1)
            return Vec2(this.x / m, this.y / m);
        return this;
    }

    static double distance(Vec2 a, Vec2 b) {
        return (a - b).mag();
    }
}