#include <iostream>
using namespace std;

int main(void){
  int n;
  cin>>n;
  while(n--){
    int x,y,w,h;
    cin>>x>>y>>w>>h;
    int m;
    cin>>m;
    int xx,yy;
    int r = 0;
    while(m--){
      cin>>xx>>yy;
      if(x <= xx && xx <= x+w && y <= yy && yy <= y+h)r++;
    }
    cout<<r<<endl;
  }
}