require 'matrix'

p0x, p0y, p1x, p1y = gets.split.map &:to_i
p0 = Vector[p0x, p0y]
p1 = Vector[p1x, p1y]

q = gets.to_i

def cross(p1, p2)
  return p1[0] * p2[1] - p1[1] * p2[0]
end

q.times do
  p2x, p2y = gets.split.map &:to_i
  p2 = Vector[p2x, p2y]
  if cross(p2-p1, p0-p1) > 0
    puts "COUNTER_CLOCKWISE"
  elsif cross(p2-p1, p0-p1) < 0
    puts "CLOCKWISE"
  elsif (p0-p1).inner_product(p2-p1) < 0
    puts "ONLINE_FRONT"
  elsif (p0-p1).norm >= (p2-p1).norm
    puts "ON_SEGMENT"
  else
    puts "ONLINE_BACK"
  end
end