#include <stdio.h>
#include <math.h>

#define EPS 1e-5

typedef struct {
    int x, y;
} vector_t;

typedef struct {
    double x, y;
} vectord_t;

void complex_div(vector_t *a, vector_t *b, vectord_t *t) {
    double d = a->x*a->x + a->y*a->y;
    t->x = (double)(a->x * b->x + a->y * b->y) / d;
    t->y = (double)(a->x * b->y - a->y * b->x) / d;
}

vector_t tmpl[10], poly[50][10];
vectord_t vec[10];

int main(void) {
    int n, m, tm, i, j;
    vector_t *tmpl, *p, v0, v1;
    vectord_t v;

    while (scanf("%d", &n) != EOF && n) {
        scanf("%d", &tm);
        for (i = 0; i < tm; i++) {
            scanf("%d%d", &(tmpl[i].x), &(tmpl[i].y));
            if (i >= 2) {
                v0.x = tmpl[i-1].x - tmpl[i-2].x;
                v0.y = tmpl[i-1].y - tmpl[i-2].y;
                v1.x = tmpl[i].x - tmpl[i-1].x;
                v1.y = tmpl[i].y - tmpl[i-1].y;
                complex_div(&v0, &v1, &(vec[i]));
            }
        }
        for (i = 0; i < n; i++) {
            p = poly[i];
            scanf("%d", &m);
            for (j = 0; j < m; j++) {
                scanf("%d%d", &(p[j].x), &(p[j].y));
            }

            for (j = 2; j < tm; j++) {
                v0.x = p[j-1].x - p[j-2].x;
                v0.y = p[j-1].y - p[j-2].y;
                v1.x = p[j].x - p[j-1].x;
                v1.y = p[j].y - p[j-1].y;
                complex_div(&v0, &v1, &v);
                if (fabs(v.x - vec[j].x) > EPS ||
                    fabs(v.y - vec[j].y) > EPS) break;
            }
            if (j == tm) {
                printf("%d\n", i + 1);
                continue;
            }
            for (j = 2; j < tm; j++) {
                v0.x = p[m-j].x - p[m-j+1].x;
                v0.y = p[m-j].y - p[m-j+1].y;
                v1.x = p[m-j-1].x - p[m-j].x;
                v1.y = p[m-j-1].y - p[m-j].y;
                complex_div(&v0, &v1, &v);
                if (fabs(v.x - vec[j].x) > EPS ||
                    fabs(v.y - vec[j].y) > EPS) break;
            }
            if (j == tm) {
                printf("%d\n", i + 1);
            }
        }

        puts("+++++");
    }
    return 0;
}