using System;
using System.Collections.Generic;
using System.Linq;

namespace CSharpSample01
{

    class Vector2
    {
        public double x;
        public double y;

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

        //「射影」
        //点pからベクトルp1p2への射影ベクトルを求める
        public Vector2 Projection(Vector2 p1, Vector2 p2, Vector2 p)
        {

            Vector2 hypo = new Vector2(p.x - p1.x, p.y - p1.y);

            Vector2 ground = new Vector2(p2.x - p1.x, p2.y - p1.y);

            Vector2 shadow = new Vector2
            {
                x = p1.x + ground.x * (hypo.x * ground.x + hypo.y * ground.y) / (ground.x * ground.x + ground.y * ground.y),
                y = p1.y + ground.y * (hypo.x * ground.x + hypo.y * ground.y) / (ground.x * ground.x + ground.y * ground.y)
            };

            return shadow;
        }

        //内積
        public double Dot(Vector2 a, Vector2 b)
        {
            return a.x * b.x + a.y * b.y;
        }

        //外積
        public double Cross(Vector2 a, Vector2 b)
        {
            return a.x * b.y - a.y * b.x;
        }

        //ベクトルの大きさ
        public double Norm(Vector2 a)
        {
            return Math.Sqrt(a.x * a.x + a.y * a.y);
        }
        

        public string Clockwise(Vector2 p0, Vector2 p1, Vector2 p2)
        {

            string str;

            Vector2 p0p1 = new Vector2(p1.x - p0.x, p1.y - p0.y);
            Vector2 p0p2 = new Vector2(p2.x - p0.x, p2.y - p0.y);
            
            if (Cross(p0p1, p0p2) > 0)
            {
                str = "COUNTER_CLOCKWISE";
            }
            else if(Cross(p0p1, p0p2) < 0)
            {
                str = "CLOCKWISE";
            }
            else
            {
                double t;
              
                if(p0p1.x != 0)
                {
                    t = p0p2.x / p0p1.x;
                }
                else
                {
                    t = p0p2.y / p0p1.y;
                }
                
                if(t < 0)
                {
                    str = "ONLINE_BACK";
                }
                else if(t > 1)
                {
                    str = "ONLINE_FRONT";
                }
                else
                {
                    str = "ON_SEGMENT";
                }

            }

            return str;
        }


    }


    class Program
    {


        static void Main(string[] args)
        {
            double[] data = Console.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();

            Vector2 p0 = new Vector2(data[0], data[1]);
            Vector2 p1 = new Vector2(data[2], data[3]);
          
            int q = int.Parse(Console.ReadLine());

            Vector2 h = new Vector2();

            for(int i = 0; i < q; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                double s = double.Parse(input[0]);
                double t = double.Parse(input[1]);

                Vector2 p2 = new Vector2(s, t);

                Console.WriteLine(h.Clockwise(p0, p1, p2));

            }


        }
    }
}



Measured memory_bytes: 18408