<image>

For given three points p0, p1, p2, print


COUNTER_CLOCKWISE


if p0, p1, p2 make a counterclockwise turn (1),


CLOCKWISE


if p0, p1, p2 make a clockwise turn (2),


ONLINE_BACK


if p2 is on a line p2, p0, p1 in this order (3),


ONLINE_FRONT


if p2 is on a line p0, p1, p2 in this order (4),


ON_SEGMENT


if p2 is on a segment p0p1 (5).

Constraints

* 1 ≤ q ≤ 1000
* -10000 ≤ xi, yi ≤ 10000
* p0 and p1 are not identical.

Input


xp0 yp0 xp1 yp1
q
xp20 yp20
xp21 yp21
...
xp2q-1 yp2q-1


In the first line, integer coordinates of p0 and p1 are given. Then, q queries are given for integer coordinates of p2.

Output

For each query, print the above mentioned status.

Examples

Input

0 0 2 0
2
-1 1
-1 -1


Output

COUNTER_CLOCKWISE
CLOCKWISE


Input

0 0 2 0
3
-1 0
0 0
3 0


Output

ONLINE_BACK
ON_SEGMENT
ONLINE_FRONT
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	static FastScanner sc = new FastScanner();
	static final double ALLOWABLE_ERROR = 0.00000001;

	public static void main(String[] args) {
		double x0 = sc.nextDouble();
		double y0 = sc.nextDouble();
		double x1 = sc.nextDouble();
		double y1 = sc.nextDouble();
		
		double a = (y1 - y0) / (x1 - x0);
		double b = y1 - a * x1;
		
		int q = sc.nextInt();
		StringBuilder ans = new StringBuilder();
		for(int i=0; i<q; i++) {
			double x = sc.nextDouble();
			double y = sc.nextDouble();
			if(x0 == x1) {
				if(x == x0) {
					if((y0 <= y && y <= y1) || (y1 <= y && y <= y0)) {
						ans.append("ON_SEGMENT");
					} else if(distance(x0, y0, x, y) < distance(x1, y1, x, y)) {
						ans.append("ONLINE_BACK");
					} else {
						ans.append("ONLINE_FRONT");
					}
				} else if((y0 < y1 && x < x0) || (y0 > y1 && x > x0)) {
					ans.append("COUNTER_CLOCKWISE");
				} else {
					ans.append("CLOCKWISE");
				}	
				
			} else {
				if(Math.abs(y - (a * x + b)) < ALLOWABLE_ERROR) {
					if((x0 <= x && x <= x1) || (x1 <= x && x <= x0)) {
						ans.append("ON_SEGMENT");
					} else if(distance(x0, y0, x, y) < distance(x1, y1, x, y)) {
						ans.append("ONLINE_BACK");
					} else {
						ans.append("ONLINE_FRONT");
					}
				} else if((x0 < x1 && y - (a * x + b) > 0) || (x0 > x1 && y - (a * x + b) < 0)) {
					ans.append("COUNTER_CLOCKWISE");
				} else {
					ans.append("CLOCKWISE");
				}				
			}
			
			ans.append("\n");
		}
		
		System.out.print(ans);
	}
	
	static double distance(double x1, double y1, double x2, double y2) {
		return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
	}

	static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}