#include <algorithm>
#include <array>
#include <assert.h>
#include <bitset>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstring>
#include <functional>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <istream>

#include <map>
#include <math.h>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

namespace asl
{
    
    template <typename numeric_type>
    class point
    {
    public:
        numeric_type x, y;

        point(numeric_type x = 0, numeric_type y = 0) : x(x), y(y) {}

        point<numeric_type> &operator-=(const point<numeric_type> &ri)
        {
            x -= ri.x;
            y -= ri.y;
            return *this;
        }

    };

    template <typename numeric_type>
    std::istream &operator>>(std::istream &is, point<numeric_type> &p)
    {
        return is >> p.x >> p.y;
    }

    template <typename numeric_type>
    class line
    {
    public:
        point<numeric_type> p, q;

    };

    template <typename numeric_type>
    std::istream &operator>>(std::istream &is, line<numeric_type> &l)
    {
        return is >> l.p >> l.q;
    }

    template <typename numeric_type>
    class segment : public line<numeric_type>
    {
    };

    template <typename numeric_type>
    numeric_type cross(point<numeric_type> a, point<numeric_type> b)
    {
        return a.x * b.y - a.y * b.x;
    }

    template <typename numeric_type>
    numeric_type dot(point<numeric_type> a, point<numeric_type> b)
    {
        return a.x * b.x + a.y * b.y;
    }

    enum PointOrder
    {
        CounterClockwise,
        Clockwise,
        AlignedFirst,
        AlignedLast,
        AlignedIn, 
    };

    template <typename numeric_type>
    PointOrder ccw(point<numeric_type> a, point<numeric_type> b, point<numeric_type> c)
    {
        b -= a;
        c -= a;
        if (cross(b, c) > 0)
            return PointOrder::CounterClockwise;
        else if (cross(b, c) < 0)
            return PointOrder::Clockwise;
        else if (dot(b, c) < 0)
            return PointOrder::AlignedFirst; 
        else if (dot(b, b) < dot(c, c))
            return PointOrder::AlignedLast; 
        else
            return PointOrder::AlignedIn; 
    }

} 

#include <stdint.h>

#include <experimental/optional>

#include <random>

#define endl '\n'

using namespace asl;
using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    segment<double> l;

    cin >> l;

    int n;
    cin >> n;

    cout.precision(10);
    cout << fixed;

    while (n--)
    {
        point<double> p;
        cin >> p;

        switch (ccw(l.p, l.q, p))
        {
        case PointOrder::CounterClockwise:
            cout << "COUNTER_CLOCKWISE" << endl;
            break;
        case PointOrder::Clockwise:
            cout << "CLOCKWISE" << endl;
            break;
        case PointOrder::AlignedFirst:
            cout << "ONLINE_BACK" << endl;
            break;
        case PointOrder::AlignedLast:
            cout << "ONLINE_FRONT" << endl;
            break;
        case PointOrder::AlignedIn:
            cout << "ON_SEGMENT" << endl;
            break;
        }
    }

    return 0;
}





Measured memory_bytes: 3304