#include <stdio.h>

int main(){

  int all,x1,y1,w,h,neko,result,x,y,i,j;

  scanf("%d",&all);

  for(j = 0; j < all; j++){

    scanf("%d %d %d %d",&x1,&y1,&w,&h);

    scanf("%d",&neko);

    result=0;
    for(i = 0; i < neko; i++){

      scanf("%d %d",&x,&y);

      if(0 <= x-x1 && x-x1 <= w && 0 <= y-y1 && y-y1 <= h) result++;

    }

    printf("%d\n",result);

  }

  return 0;

}