#include<stdio.h>
int main(){
	int d,n,i,c,catX,catY,campusX,campusY,campusW,campusH;
	scanf("%d",&d);
	for(;d>0&&scanf("%d %d %d %d",&campusX,&campusY,&campusW,&campusH);d--){
		c=0;
		scanf("%d",&n);
		for(i=0;i<n&&scanf("%d %d",&catX,&catY);i++){
			if((campusX<=catX&&campusX+campusW>=catX)
					&&(campusY<=catY&&campusY+campusH>=catY)){
				c++;
			}
		}
		printf("%d\n",c);
	}
	return 0;
}