macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; ( iter = $ iter : ident , $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut $ iter = s . split_whitespace ( ) ; input_inner ! { $ iter , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let s = { use std :: io :: Read ; let mut s = String :: new ( ) ; std :: io :: stdin ( ) . read_to_string ( & mut s ) . unwrap ( ) ; s } ; let mut iter = s . split_whitespace ( ) ; input_inner ! { iter , $ ( $ r ) * } } ; }
macro_rules ! input_inner { ( $ iter : expr ) => { } ; ( $ iter : expr , ) => { } ; ( $ iter : expr , mut $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let mut $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , mut $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , mut $ var : usize $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ iter , $ t ) ; input_inner ! { $ iter $ ( $ r ) * } } ; ( $ iter : expr , $ var : ident $ ( $ r : tt ) * ) => { input_inner ! { $ iter , $ var : usize $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ iter : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ iter , $ t ) ) ,* ) } ; ( $ iter : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ iter , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ iter : expr , { chars : $ base : expr } ) => { read_value ! ( $ iter , String ) . chars ( ) . map ( | c | ( c as u8 - $ base as u8 ) as usize ) . collect ::< Vec < usize >> ( ) } ; ( $ iter : expr , { char : $ base : expr } ) => { read_value ! ( $ iter , { chars : $ base } ) [ 0 ] } ; ( $ iter : expr , chars ) => { read_value ! ( $ iter , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ iter : expr , char ) => { read_value ! ( $ iter , chars ) [ 0 ] } ; ( $ iter : expr , usize1 ) => { read_value ! ( $ iter , usize ) - 1 } ; ( $ iter : expr , $ t : ty ) => { $ iter . next ( ) . unwrap ( ) . parse ::<$ t > ( ) . unwrap ( ) } ; }
#[derive(Clone, Copy, Debug, Default, PartialEq)]
pub struct Complex {
    pub x: f64,
    pub y: f64,
}
impl Complex {
    pub fn new(x: f64, y: f64) -> Complex {
        Complex { x: x, y: y }
    }
    pub fn from_radian(theta: f64) -> Complex {
        Complex::new(theta.cos(), theta.sin())
    }
    pub fn abs(self) -> f64 {
        (self.x * self.x + self.y * self.y).sqrt()
    }
    pub fn dot(self, other: Complex) -> f64 {
        self.x * other.x + self.y * other.y
    }
    pub fn cross(self, other: Complex) -> f64 {
        self.x * other.y - self.y * other.x
    }
    pub fn conjugate(self) -> Complex {
        Complex {
            x: self.x,
            y: -self.y,
        }
    }
    pub fn angle(self) -> f64 {
        self.y.atan2(self.x)
    }
}
impl std::ops::Add for Complex {
    type Output = Complex;
    fn add(self, other: Complex) -> Complex {
        Complex {
            x: self.x + other.x,
            y: self.y + other.y,
        }
    }
}
impl std::ops::Add<f64> for Complex {
    type Output = Complex;
    fn add(self, other: f64) -> Complex {
        Complex {
            x: self.x + other,
            y: self.y + other,
        }
    }
}
impl std::ops::Sub for Complex {
    type Output = Complex;
    fn sub(self, other: Complex) -> Complex {
        Complex {
            x: self.x - other.x,
            y: self.y - other.y,
        }
    }
}
impl std::ops::Sub<f64> for Complex {
    type Output = Complex;
    fn sub(self, other: f64) -> Complex {
        Complex {
            x: self.x - other,
            y: self.y - other,
        }
    }
}
impl std::ops::Mul for Complex {
    type Output = Complex;
    fn mul(self, other: Complex) -> Complex {
        Complex {
            x: self.x * other.x - self.y * other.y,
            y: self.x * other.y + self.y * other.x,
        }
    }
}
impl std::ops::Mul<f64> for Complex {
    type Output = Complex;
    fn mul(self, other: f64) -> Complex {
        Complex {
            x: self.x * other,
            y: self.y * other,
        }
    }
}
impl std::ops::Div for Complex {
    type Output = Complex;
    fn div(self, other: Complex) -> Complex {
        self * other.conjugate() / other.abs()
    }
}
impl std::ops::Div<f64> for Complex {
    type Output = Complex;
    fn div(self, other: f64) -> Complex {
        Complex {
            x: self.x / other,
            y: self.y / other,
        }
    }
}
impl std::ops::Neg for Complex {
    type Output = Complex;
    fn neg(self) -> Complex {
        Complex {
            x: -self.x,
            y: -self.y,
        }
    }
}
fn ccw(a: Complex, b: Complex, c: Complex) -> i8 {
    let x = b - a;
    let y = c - a;
    if x.cross(y) > 0. {
        return 1; // COUNTER_CLOCKWISE
    }
    if x.cross(y) < 0. {
        return -1; // CLOCKWISE
    }
    if x.dot(y) < 0. {
        return 2; // ONLINE_BACK
    }
    if x.abs() < y.abs() {
        return -2; // ONLINE_FRONT
    };
    return 0; // ON_SEGMENT
}
fn main() {
    input! { p0: [(f64, f64); 2], q, ps: [(f64, f64); q] };
    let p0 = p0
        .into_iter()
        .map(|(x, y)| Complex::new(x, y))
        .collect::<Vec<_>>();
    let ps = ps
        .into_iter()
        .map(|(x, y)| Complex::new(x, y))
        .collect::<Vec<_>>();
    for i in 0..q {
        let s = match ccw(p0[0], p0[1], ps[i]) {
            1 => "COUNTER_CLOCKWISE",
            -1 => "CLOCKWISE",
            2 => "ONLINE_BACK",
            -2 => "ONLINE_FRONT",
            0 => "ON_SEGMENT",
            _ => unreachable!(),
        };
        println!("{}", s);
    }
}



Measured memory_bytes: 5056