def projecter(x, y, xp, yp)
  return (xp * x + yp * y) / (x ** 2 + y ** 2), (yp * x - xp * y) / (x ** 2 + y ** 2)
end
def main(input = STDIN)
  x1, y1, x2, y2 = input.gets.split(" ").map(&:to_r)
  q = input.gets.to_i
  x, y = (x2 - x1), (y2 - y1)
  q.times do
    xp, yp = input.gets.split(" ").map(&:to_r)
    a, b = projecter(x, y, xp - x1, yp - y1)
    if b > 0
      puts "COUNTER_CLOCKWISE"
    elsif b < 0
      puts "CLOCKWISE"
    elsif a < 0
      puts "ONLINE_BACK"
    elsif a > 1
      puts "ONLINE_FRONT"
    else
      puts "ON_SEGMENT"
    end
  end
end
main