#include<stdio.h>

int main(void){
  int i,num,j;
  int x,y,w,h,n;
  int nx,ny;
  int count;

  scanf("%d",&num);

  for(i=0;i<num;i++){
    scanf("%d%d%d%d%d",&x,&y,&w,&h,&n);

    count=0;

    for(j=0;j<n;j++){
      scanf("%d%d",&nx,&ny);
      if(x<=nx && nx<=x+w &&
          y<=ny && ny<=y+h)
        count++;
    }

    printf("%d\n",count);
  }

  return 0;
}