#include <stdio.h>
#include <stdlib.h>

typedef struct p { int x, y; } P;

int comp(const void* a, const void* b)
{
    P p=*((P*)a);
    P q=*((P*)b);
    return p.x==q.x ? p.y>q.y : p.x>q.x;
}

void rotate(P* p, int n)
{
    int i, t;
    for(i=0;i<n;++i) { t=p[i].x; p[i].x=-p[i].y; p[i].y=t; }
}

int main(void)
{
    int n;
    P p[10], q[10];
    while (scanf("%d", &n), n) {
        int i, j, k, m;
        scanf("%d", &m);
        for(i=0;i<m;++i) scanf("%d%d", &p[i].x, &p[i].y);
        qsort(p, m, sizeof(P), comp);
        for(i=1;i<m;++i) { p[i].x-=p[0].x; p[i].y-=p[0].y; }

        for(i=1;i<=n;++i) {
            scanf("%d", &m);
            for(j=0;j<m;++j) scanf("%d%d", &q[j].x, &q[j].y);
            for(k=0;k<4;++k) {
                int ok=1;
                rotate(q, m);
                qsort(q, m, sizeof(P), comp);
                for(j=1;j<m;++j) {
                    int x=q[j].x-q[0].x, y=q[j].y-q[0].y;
                    if (x!=p[j].x || y!=p[j].y) ok=0;
                }
                if (ok) {
                    printf("%d\n", i);
                    break;
                }
            }
        }
        puts("+++++");
    }
    return 0;
}