x1, y1, x2, y2 = gets.split.map(&:to_i)
u = (x2 - x1) + (y2 - y1) * 1i
gets.to_i.times do
  x, y = gets.split.map(&:to_i)
  v = x - x1 + (y - y1) * 1i
  d, c = (u.conj * v).rect
  case
  when c > 0
    puts 'COUNTER_CLOCKWISE'
  when c < 0
    puts 'CLOCKWISE'
  when d < 0
    puts 'ONLINE_BACK'
  when d > (u.conj * u).real
    puts 'ONLINE_FRONT'
  else
    puts 'ON_SEGMENT'
  end
end