require 'complex'

# Complex * Complex -> Double                                                          

def dot(c1, c2)
  (c1.conj * c2).real
end

# Complex * Complex -> Double                                                          
def cross(c1, c2)
  (c1.conj * c2).imag
end

# Complex * Complex * Complex -> Complex                                               
# return the proj of vector p0p to vector p0p1                                         
def proj(p0, p1, p)
  (p1 - p0) * dot(p1 - p0, p - p0) / ((p1 - p0).abs ** 2) + p0
end


def sign d
  eps = 1e-8
  d < -eps ? -1 : (d > eps ? 1 : 0)
end

# Complex * Complex * Complex -> Bool                                                  
# Return true if Point q is on segment p1p2                                            
# otherwise return false                                                               
def on_seg(p1, p2, q)
  sign(cross(p1 - q, p2 - q)) == 0 &&
    sign(dot(p1 - q, p2 - q)) < 0
end

def direct(p0, p1, p2)
  d = cross(p1 - p0, p2 - p0)
  if sign(d) == 1
    :COUNTER_CLOCKWISE
  elsif sign(d) == -1
    :CLOCKWISE
  else
    if on_seg(p2, p1, p0)
      :ONLINE_BACK
    elsif on_seg(p0, p2, p1)
      :ONLINE_FRONT
    else
      :ON_SEGMENT
    end
  end  
end

def main
  xp0, yp0, xp1, yp1 = gets.chomp.split(/\s/).collect { |x| x.to_f}
  q = gets.chomp.to_i
  (1..q).each do |ca|
    p0 = Complex(xp0, yp0)
    p1 = Complex(xp1, yp1)
    x, y = gets.chomp.split(/\s/).collect { |x| x.to_f}
    p = Complex(x, y)
    puts direct(p0, p1, p).to_s
  end
end

main