// Meteoros
#include <stdio.h>

int main() {
	int teste, i, dentro, x1, x2, y1, y2, x, y, n;

	for (teste=1; scanf("%d %d %d %d", &x1, &y1, &x2, &y2)&&(x1!=0||x2!=0||y1!=0||y2!=0); teste++) {
		scanf("%d", &n);
		dentro=0;
		printf("Teste %d\n", teste);
		for (i=0; i<n; i++) {
			scanf("%d %d", &x, &y);
			if (x1<=x&&x<=x2 && y1>=y&&y>=y2) {
				dentro++;
			}
		}
		printf("%d\n\n", dentro);
	}

	return 0;
}

