#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define pb push_back
#define x first
#define y second
#define pt pair<ll,ll>
#define prec(x) fixed << setprecision(x)
using namespace std;

ll n;
vector<pt > pts;
vector<ld > angs;
pair<ld,ld> cc;
vector<ll> prefArea;
vector<ll> prefPts;

ld f(ld ang){return ((ang * 180.0) / acos(-1.L));}
ld calcAngle(ll x11,ll y11,ld xc,ld yc){
	ld x1 = (ld)(x11 * 1.0);
	ld y1 = (ld)(y11 * 1.0);
	if(x1 == xc){
		if(y1 > yc){
			return (ld)(90.0);
		}
		else{
			return (ld)(270.0);
		}
	}
	if(y1 == yc){
		if(x1 > xc){
			return (ld)(0.0);
		}
		else{
			return (ld)(180.0);
		}
	}
	if(x1 > xc){
		if(y1 > yc){
			ld angle = f(atan((ld)(y1 - yc) / (ld)(x1 - xc)));
			return angle;
		}
		else{
			ld angle = (ld)(360.0) - f(atan((ld)(yc - y1) / (ld)(x1 - xc)));
			return angle;
		}
	}
	if(x1 < xc){
		if(y1 > yc){
			ld angle = (ld)(180.0) - f(atan((ld)(y1 - yc) / (ld)(xc - x1)));
			return angle;
		}
		else{
			ld angle = (ld)(180.0) + f(atan((ld)(yc - y1) / (ld)(xc - x1)));
			return angle;
		}
	}
	return 0.0;
}
ll numOfPtsOnALine(ll x1,ll y1,ll x2,ll y2){
	if(x1 == x2 && y1 == y2) return 0LL;
	if(x1 == x2){
        if(y2 < y1) swap(y1,y2);
        return (y2 - y1);
    }
    if(y1 == y2){
        if(x2 < x1) swap(x1,x2);
        return (x2 - x1);
    }
    ll dx = abs(x2 - x1);
    ll dy = abs(y2 - y1);
    return __gcd(dx,dy);
}
ll f(ll x1,ll y1,ll x2,ll y2){
	// cout << x1 << " " << y1 << " " << x2 << " " << y2 << " --->>>\n";
    if(x1 == x2){
        if(y2 < y1) swap(y1,y2);
        return (y2 - y1 + 1);
    }
    if(y1 == y2){
        if(x2 < x1) swap(x1,x2);
        return (x2 - x1 + 1);
    }
    ll dx = abs(x2 - x1);
    ll dy = abs(y2 - y1);
    return __gcd(dx,dy) + 1;
}
ll myFunc(vector<pt> v){
	ll n = v.size() - 1;
	v.erase(v.begin());
	v.pb(v[0]);
	ll area = 0;
	ll pp = 0;
	// cout << "----------------\n";
	for(ll i = 0;i < n;i++){
		// cout << v[i].x << " " << v[i].y << "\n";
		area = area + (v[i + 1].x * v[i].y - v[i + 1].y * v[i].x);
		pp = pp + f(v[i].x,v[i].y,v[i + 1].x,v[i + 1].y);
	}
	// cout << "-----------------\n";
	area = abs(area);
	// cout << "AREA : " << area << "\n";
	pp = pp - n;
	// cout << " POINTS : " << pp << "\n";
	ll ret = abs((area - pp + 2) / 2);
	return ret;
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n;
	
	vector<pt> temppts;
	temppts.pb({-1,-1});

	cout << prec(8);

	cc.x = (ld)(0.0);
	cc.y = (ld)(0.0);
	for(ll i = 1;i <= n;i++){
		ll tmpx,tmpy;
		cin >> tmpx >> tmpy;
		cc.x = cc.x + tmpx * 1.0;
		cc.y = cc.y + tmpy * 1.0;
		temppts.pb({tmpx,tmpy});
	}

	cc.x = (cc.x) / (ld)(n * 1.0);
	cc.y = (cc.y) / (ld)(n * 1.0);

	set<pair<ld,pt> > ss;
	set<pt> allPoints;

	for(ll i = 1;i <= n;i++){
		ss.insert({calcAngle(temppts[i].x,temppts[i].y,cc.x,cc.y),temppts[i]});
		allPoints.insert(temppts[i]);
	}

	pts.pb({-1,-1});	// 1 based indexing
	angs.pb(-1);
	for(auto z : ss){
		pts.pb(z.y);
		angs.pb(z.x);
	}
	ll NUMOFPOINTS = myFunc(pts);
	// cout << "NUMOFPOINTS -> " << NUMOFPOINTS << "\n";
	pts.pb(pts[1]);

	prefPts.pb(0);
	prefArea.pb(0);

	for(ll i = 1;i <= n;i++){
		prefArea.pb(prefArea[i - 1] + (pts[i + 1].x * pts[i].y - pts[i + 1].y * pts[i].x));
		prefPts.pb(prefPts[i - 1] + numOfPtsOnALine(pts[i].x,pts[i].y,pts[i + 1].x,pts[i + 1].y));
	}
	/*
	cout << "PRINTING THE ANGLES : \n";
	for(auto x : angs){
		cout << x << "\n";
	}
	cout << "--------------------------\n";
	cout << "PRINTING THE AREA ARRAY : \n";
	ll oo = 0;
	for(auto z : prefArea){
		cout << pts[oo].x << " " << pts[oo].y << " " << z << "\n";
		oo++;
	}
	cout << "-------------------------\n";
	cout << "PRINTING THE POINTS ARRAY : \n";
	oo = 0;
	for(auto x : prefPts){
		cout << oo << " " << x << "\n";
		oo++;
	}
	cout << "-------------------------\n";
	*/
	ll q;
	cin >> q;
	while(q--){
		pt p,q;
		cin >> p.x >> p.y >> q.x >> q.y;
		ld pang = calcAngle(p.x,p.y,cc.x,cc.y);
		ld qang = calcAngle(q.x,q.y,cc.x,cc.y);
		if(qang < pang){
			swap(p,q);
			swap(pang,qang);
		}
		// cout << "chhota angle " << pang << " bada angle " << qang << "\n";
		ll pidx;
		auto pit = lower_bound(angs.begin(),angs.end(),pang);
		pidx = (pit - angs.begin());
		ll qidx;
		auto qit = lower_bound(angs.begin(),angs.end(),qang);
		if(*(qit) != qang) qit--;
		qidx = (qit - angs.begin());

		pt fpt = pts[pidx];
		pt bpt = pts[qidx];
		// cout << "FPT x " << fpt.x << " y " << fpt.y << "\n";
		// cout << "BPT x " << bpt.x << " y " << bpt.y << "\n";

		ll area = prefArea[qidx - 1] - prefArea[pidx - 1];
		area += fpt.x * p.y - fpt.y * p.x;
		area += q.x * bpt.y - q.y * bpt.x;
		area += p.x * q.y - q.x * p.y;


		ll ppts = prefPts[qidx - 1] - prefPts[pidx - 1];
		// cout << ppts << " !!!!!!!!!!!\n";
		
		if(allPoints.find(p) == allPoints.end())
			ppts += numOfPtsOnALine(fpt.x,fpt.y,p.x,p.y);
		// cout << ppts << " !!!!!!!!!!!\n";
		
		ppts += numOfPtsOnALine(p.x,p.y,q.x,q.y);
		// cout << ppts << " !!!!!!!!!!!\n";
		
		if(allPoints.find(q) == allPoints.end())
			ppts += numOfPtsOnALine(bpt.x,bpt.y,q.x,q.y);
		// cout << ppts << " !!!!!!!!!!!\n";

		// cout << pidx << " " << qidx << "\n";
		// cout << "AREA = " << area << " PERIMETER POINTS = " << ppts << "\n";

		ll ans = (abs(area) - ppts + 2) / 2;
		ll tempwa = NUMOFPOINTS - numOfPtsOnALine(p.x,p.y,q.x,q.y) + 1;
		cout << min(ans,tempwa - ans) << " " << max(ans,tempwa - ans) << "\n"; 

	}

	return 0;
}