#include #include #include #include #include #include using namespace std; typedef pair P; const int maxn=505; const int inf=1e6; int n,m,vis[maxn]; struct node{ int x,y; inline node operator-(const node&a)const{ return (node){x-a.x,y-a.y}; } inline int operator*(const node&a)const{ return x*a.y-y*a.x; } }a[maxn],b[maxn]; vectored[maxn]; namespace IO{ inline int read() { int x=0,f=1; char ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-')f=-1; ch=getchar(); } while(ch>='0'&&ch<='9') { x=x*10+ch-'0'; ch=getchar(); } return x*f; } inline void write(int x) { int t[50]={0},cnt=0; while(x)t[++cnt]=x%10,x/=10; if(!cnt)putchar('0'); else while(cnt)putchar(t[cnt--]+'0'); puts(""); } }; using namespace IO; double dis(node a,node b) { return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)*1.0); } inline bool spec() { for(int i=1;i<=n;i++) if(abs(a[i].x-a[1].x)>0 || abs(a[i].y-a[1].y)>0) return 0; for(int i=1;i<=m;i++) if(abs(b[i].x-a[1].x)>0 || abs(b[i].y-a[1].y)>0) return 0; write(1); return 1; } inline int check(int x,int y) { int l=0,mid=0,r=0; node c=b[y]-b[x]; for(int i=1;i<=n;i++) { node d=a[i]-b[x]; int k=c*d; if(k>0)l++; else if(k<0)r++; else { //if(d.x*c.x>=0&&d.y*c.y>=0&&dis(d,b[x])<=dis(c,b[x]))mid++; mid++; } if(l&&r)break; } return mid==n?2:(l+mid==n?1:(r+mid==n?3:0)); } inline int bfs(int s) { memset(vis,0,sizeof(vis)); queue

qx; qx.push(P(s,1)); vis[s]=1; while(!qx.empty()) { P x=qx.front(); qx.pop(); for(auto y:ed[x.first]) { if(y==s)return x.second; if(!vis[y]) { vis[y]=1; qx.push(P(y,x.second+1)); } } } return inf+1; } int main() { while(cin>>n) { for(int i=1;i<=n;i++)a[i]=(node){read(),read()}; m=read(); for(int i=1;i<=m;i++)ed[i].clear(); for(int i=1;i<=m;i++)b[i]=(node){read(),read()}; if(spec())continue; for(int i=1;i<=m;i++) { for(int j=i+1;j<=m;j++) { int jd=check(i,j); if(jd==1)ed[i].push_back(j); else if(jd==2)ed[i].push_back(j),ed[j].push_back(i); else if(jd==3)ed[j].push_back(i); } } int ans=inf; for(int i=1;i<=m;i++)ans=min(ans,bfs(i)); if(ans>=inf)puts("ToT"); else write(m-ans); } return 0; }