import scala.io.StdIn.{readLine, readInt}
import scala.collection.mutable.ArrayBuffer

object Main {
  def cross(x0:Double, y0:Double, x1:Double, y1:Double) = x0*y1-x1*y0
  def inner(x0:Double, y0:Double, x1:Double, y1:Double) = x0*x1+y1*y0
  def norm(x:Double, y:Double) = Math.pow(x,2)+Math.pow(y,2)

  def main(args:Array[String]) = {
   val b = new ArrayBuffer[String]
   val p = readLine.split(" ").map(_.toDouble)
   val n = readInt

   val (x0,y0,x1,y1) = (p(0),p(1),p(2),p(3))
   val (x,y) = (x1-x0,y1-y0)

   for(i<-0 until n) {
     val p1 = readLine.split(" ").map(_.toDouble)
     val (x2,y2) = (p1(0)-x0, p1(1)-y0)
     if(cross(x,y,x2,y2) > (1e-10)) b += "COUNTER_CLOCKWISE"
     else if(cross(x,y,x2,y2) < -(1e-10)) b += "CLOCKWISE"
     else if(inner(x,y,x2,y2) < -(1e-10)) b += "ONLINE_BACK"
     else if(norm(x,y) < norm(x2,y2)) b += "ONLINE_FRONT"
     else b += "ON_SEGMENT"
   }
   println(b.mkString("\n"))
  }
}