// Aizu 1136: Polygonal Line Search
// 2017.9.14 bal4u@uu

#include <stdio.h>

typedef struct { int x, y; } PP;
typedef struct { int m; PP p[11]; } LN;
LN line[52]; int n;

void rot90(LN *ln)
{
	int i, x, y;
	for (i = 0; i < ln->m; i++) {
		x = ln->p[i].x, y = ln->p[i].y;
		ln->p[i].x = y, ln->p[i].y = -x;
	}
}

int match(LN *ln)
{
	int i, j, dx, dy;

	for (j = 0; j < 4; j++) {
		dx = ln->p[0].x - line[0].p[0].x, dy = ln->p[0].y - line[0].p[0].y;
		for (i = 1; i < ln->m; i++)
			if (ln->p[i].x - line[0].p[i].x != dx || ln->p[i].y - line[0].p[i].y != dy) break;
		if (i >= ln->m) return 1;
		rot90(ln);
	}
	return 0;
}

int main()
{
	int m, i, j;
	LN tmp1, tmp2;

	while(scanf("%d", &n) && n) {
		for (i = 0; i <= n; i++) {
			scanf("%d", &m); line[i].m = m;
			for (j = 0; j < m; j++) scanf("%d%d", &line[i].p[j].x, &line[i].p[j].y);
		}
		for (i = 1; i <= n; i++) {
			if ((m = line[0].m) != line[i].m) continue;
			tmp1 = line[i]; tmp2.m = m;	for (j = 0; j < m; j++)	tmp2.p[j] = line[i].p[m-1-j];
			if (match(&tmp1) || match(&tmp2)) printf("%d\n", i);
		}
		puts("+++++");
	}
	return 0;
}