#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int Max=1050;
struct e{
int x1,x2;
}edge[Max];
struct c{
int x,y;
}cal[4];
int n,m;
int X1,Y1,X2,Y2;
int ans[Max],co[Max];
int u,v;
bool cmp(struct e A,struct e B){
if(A.x1<B.x1) return true;
return false;
}
void init(){
for(int i=0;i<=n;i++){
ans[i]=0; co[i]=0;
}
}
bool in(){
if(u>=X1&&u<=X2&&v>=Y2&&v<=Y1)
return true;
return false;
}
__int64 multi(int i){
int j=i+1;
if(j==4) j=0;
return (__int64)(u-cal[i].x)*(__int64)(cal[j].y-cal[i].y)-(__int64)(v-cal[i].y)*(__int64)(cal[j].x-cal[i].x);
}
bool judge(int mid){
__int64 pre,now;
cal[0].x=edge[mid].x1; cal[0].y=Y1;
cal[1].x=X2; cal[1].y=Y1;
cal[2].x=X2; cal[2].y=Y2;
cal[3].x=edge[mid].x2; cal[3].y=Y2;
for(int i=0;i<4;i++){
now=multi(i);
if(i>0){
if(pre*now<0)
return false;
}
pre=now;
}
return true;
}
void slove(){
int low=0,high=n;
int anst;
while(low<=high){
int mid=(low+high)/2;
if(judge(mid)){
anst=mid; low=mid+1;
}
else high=mid-1;
}
int k=ans[anst];
co[k]--;
ans[anst]++;
co[k+1]++;
}
int main(){
while(scanf("%d",&n)!=EOF){
if(n==0) break;
scanf("%d%d%d%d%d",&m,&X1,&Y1,&X2,&Y2);
init();
co[0]=m;
edge[0].x1=X1,edge[0].x2=X1;
for(int i=1;i<=n;i++){
scanf("%d%d",&edge[i].x1,&edge[i].x2);
}
sort(edge,edge+n+1,cmp);
for(int i=0;i<m;i++){
scanf("%d%d",&u,&v);
if(in())
slove();
}
printf("Box\n");
for(int i=1;i<=m;i++){
if(co[i]){
printf("%d: %d\n",i,co[i]);
}
}
}
return 0;
}