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 = (u.conj * v).imag
  case
  when d > 0
    puts 'COUNTER_CLOCKWISE'
  when d < 0
    puts 'CLOCKWISE'
  else
    d = (v / u).real
    case
    when d < 0
      puts 'ONLINE_BACK'
    when d < 1
      puts 'ON_SEGMENT'
    else
      puts 'ONLINE_FRONT'
    end
  end
end