x0, y0, x1, y1 = gets.split.map(&:to_f)

v0x = x1 - x0
v0y = y1 - y0
r0 = v0x*v0x+v0y*v0y
q = gets.to_i
q.times{
  x, y = gets.split.map(&:to_f)
  v1x = x - x0
  v1y = y - y0
  r1 = v1x*v1x+v1y*v1y
  cross_product = v0x * v1y - v0y * v1x
  if cross_product > 0
    puts "COUNTER_CLOCKWISE"
  elsif cross_product < 0
    puts "CLOCKWISE"
  else
    if v0x * v1x < 0 || v0y * v1y < 0
      puts "ONLINE_BACK"
    else
      if r0 < r1
        puts "ONLINE_FRONT"
      else
        puts "ON_SEGMENT"
      end
    end
  end
}