#include<bits/stdc++.h>
using namespace std;
typedef struct { double x,y;} point;

double nai(point a,point b){ return a.x*b.x+a.y*b.y; }

int main(){
point p1,p2;
double x,y;
cin>>x>>y;
p1.x=x;
p1.y=y;
cin>>x>>y;
p2.x=x;
p2.y=y;
point vec={p2.x-p1.x , p2.y-p1.y};
//point e={vec.x/sqrt(nai(vec,vec)) , vec.y/sqrt(nai(vec,vec))};
int q;
cin>>q;
for(int i=0;i<q;i++){
cin>>x>>y;
point p;
p.x=x-p1.x;
p.y=y-p1.y;
point j={p.x*vec.x+p.y*vec.y,vec.x*p.y-vec.y*p.x};
if(j.y>0){
cout<<"COUNTER_CLOCKWISE"<<endl;
}else if(j.y<0){
cout<<"CLOCKWISE"<<endl;
}else{
if(j.x<0){
cout<<"ONLINE_BACK"<<endl;
}else if(nai(p,p)>nai(vec,vec)){
cout<<"ONLINE_FRONT"<<endl;
}else{
cout<<"ON_SEGMENT"<<endl;
}

}


}
return 0;
}

