#include<iostream>
using namespace std;
int main(){
	int X,Y,W,H,N,n;
	cin>>n;
	for(int j=0;j<n;j++){
	int count=0;
		int x,y;
	cin>>X>>Y>>W>>H>>N;
	for(int i=0;i<N;i++){
		cin>>x>>y;
		if(X<=x&&(X+W)>=x&&Y<=y&&(Y+H)>=y)count++;
	}
	cout<<count<<"\n";
	}
	return 0;
}