#include <stdio.h>

/** Application main entry point. */
int main (
  int     argc,
  char  * argv[ ]
  )
{
  int ds;

  scanf ( "%d", &ds );
  while ( ds-- )
  {
    int x, y, w, h;
    int res = 0;
    int n;

    scanf ( "%d%d%d%d", &x, &y, &w, &h );
    scanf ( "%d", &n );

    while ( n-- )
    {
      int u, v;

      scanf ( "%d%d", &u, &v );

      res += !!( ( u >= x && u <= x + w )
              && ( v >= y && v <= y + h ) );
    }
    
    printf ( "%d\n", res );
  }

  return ( 0 );
}