#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const int mod=1000000 ;
const llint big=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
//17:00~

int main(void){
	cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);
	int n,i;cin>>n;
	double zx=0,zy=0;
	vector<pair<double,double>>sro(n+2);
	for(i=0;i<n;i++){
		double x,y;cin>>x>>y;y*=-1;x*=10000/9999.0;y*=10000/9999.0;
		sro[i]=mp(x,y);zx+=x;zy+=y;
	}
	sro[n]=sro[0];sro[n+1]=sro[1];zx/=n;zy/=n;
	int Q;cin>>Q;
	vector<pair<double,double>>kro(Q);
	for(i=0;i<Q;i++){
		double x,y;cin>>x>>y;y*=-1;
		kro[i]=mp(x,y);
	}
	vector<pair<double,int>>zyo(Q+n+1);
	double kizyu=atan2(sro[0].fir-zx,sro[0].sec-zy);
	zyo[0]=mp(0.0,1);zyo[n]=mp(pai*2,1+n);
	vector<double>Skak(n+2);
	for(i=1;i<n;i++){
		double kak=atan2(sro[i].fir-zx,sro[i].sec-zy)-kizyu;
		while(kak<0){kak+=pai*2;}
		while(kak>pai*2){kak-=pai*2;}
		Skak[i]=kak;
		zyo[i]=mp(kak,i+1);
	}
	Skak[0]=0;Skak[n]=pai*2;Skak[n+1]=Skak[1]+pai*2;
	for(i=0;i<Q;i++){
		double kak;
		if(kro[i]==mp(zx,zy)){kak=pai;}
		else{kak=atan2(kro[i].fir-zx,kro[i].sec-zy)-kizyu;}
		while(kak<0){kak+=pai*2;}
		while(kak>pai*2){kak-=pai*2;}
		zyo[i+n+1]=mp(kak,-i-1);
	}
	SO(zyo);
	double mx=sro[n-1].fir,my=sro[n-1].sec,mk=Skak[n-1]-pai*2,md=sqrt((mx-zx)*(mx-zx)+(my-zy)*(my-zy));
	double nx=sro[0].fir,ny=sro[0].sec,nk=0,nd=sqrt((nx-zx)*(nx-zx)+(ny-zy)*(ny-zy));
	vector<bool>ans(Q);
	for(auto it:zyo){
		int p=it.sec;
		if(p>0){
			p--;
			//cerr<<"p="<<p<<endl;
			mx=sro[p].fir;my=sro[p].sec;mk=Skak[p];md=sqrt((mx-zx)*(mx-zx)+(my-zy)*(my-zy));
			nx=sro[p+1].fir;ny=sro[p+1].sec;nk=Skak[p+1];nd=sqrt((nx-zx)*(nx-zx)+(ny-zy)*(ny-zy));
		}else{
			p*=-1;
			p--;
			double px=kro[p].fir,py=kro[p].sec,pk=it.fir,pd=sqrt((px-zx)*(px-zx)+(py-zy)*(py-zy));
			double S=sin(nk-mk)*md*nd;
			S-=sin(nk-pk)*nd*pd;
			S-=sin(pk-mk)*pd*md;
			//cerr<<nk<<' '<<pk<<' '<<mk<<endl;
			ans[p]=(S>=0);
		}
	}
	for(i=0;i<Q;i++){cout<<ans[i]<<endl;}
	return 0;
}



Measured memory_bytes: 6456