x0, y0, x1, y1 = gets.chomp.split.map(&:to_f)
len1 = (x1 - x0) ** 2 + (y1 - y0) ** 2
 
gets.to_i.times{
    x2, y2 = gets.chomp.split.map(&:to_f)
    len2 = (x2 - x0) ** 2 + (y2 - y0) ** 2
    yonline = (y1 - y0) / (x1 - x0) * (x2 - x0) + y0 if x0 != x1
 
    arr = []
    if x0 < x1
        arr = [yonline, y2, (x1 - x0) * (x2 - x0)]
    elsif x0 > x1
        arr = [y2, yonline, (x1 - x0) * (x2 - x0)]
    else
        if y0 < y1
            arr = [x2, x0, (y1 - y0) * (y2 - y0)]
        else
            arr = [x0, x2, (y1 - y0) * (y2 - y0)]
        end
    end
 
    judge = ""
    if arr[0] < arr[1]
        judge = "COUNTER_CLOCKWISE"
    elsif arr[0] > arr[1]
        judge = "CLOCKWISE"
    else
        if arr[2] < 0
            judge = "ONLINE_BACK"
        else
            if len1 < len2
                judge = "ONLINE_FRONT"
            else
                judge = "ON_SEGMENT"
            end
        end
    end
    puts judge
}

