import Control.Applicative ((<$>))
import Control.Monad
import Data.Complex

type Vector = Complex Double

eps :: Double
eps = 1e-7

dot :: Vector -> Vector -> Double
dot a b = realPart $ conjugate a * b

cross :: Vector -> Vector -> Double
cross a b = imagPart $ conjugate a * b

readWords :: Read a => IO [a]
readWords = map read . words <$> getLine

main :: IO ()
main = do
  [x1,y1,x2,y2] <- readWords :: IO [Double]
  let
    p0 = x1:+y1
    p1 = x2:+y2

  q <- readLn

  ps <- replicateM q $ do
    [x,y] <- readWords :: IO [Double]
    return $ x:+y

  forM_ ps $ \p2 -> do
    let sgn = (p1-p0)`cross`(p2-p0)

    when (sgn > eps) $ putStrLn "COUNTER_CLOCKWISE"
    when (sgn < -eps) $ putStrLn "CLOCKWISE"

    when (abs sgn < eps) $ do
      if (p1-p0)`dot`(p2-p0) < 0
        then putStrLn "ONLINE_BACK"
        else if magnitude (p2-p0) > magnitude (p1-p0)
          then putStrLn "ONLINE_FRONT"
          else putStrLn "ON_SEGMENT"