import scala.io.StdIn._

import Math._
object Main extends App {
  val eps0 = 1e-12

  val Seq(xp1, yp1, xp2, yp2) = readLine.split(' ').map(_.toDouble).toList
  val vx1 = xp2 - xp1
  val vy1 = yp2 - yp1


  val q = readLine.toInt
  for (i <- 0 until q) {
    val Seq(x, y) = readLine.split(' ').map(_.toDouble).toList
    val vx2 = x - xp1
    val vy2 = y - yp1

    val rot = vx1 * vy2 - vy1 * vx2

    println(if (rot.abs < eps0) {
      if (vx1 * vx2 + vy1 * vy2 < 0) {
        "ONLINE_BACK"
      } else {
        if (vx2*vx2 + vy2*vy2 > vx1*vx1 + vy1*vy1) "ONLINE_FRONT" else "ON_SEGMENT"
      }
    } else {
      if (rot > 0) "COUNTER_CLOCKWISE" else "CLOCKWISE"
    })
  }
}

