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

typedef struct{
    int x, y;
}vector;

int main(void)
{
    while(1){
        int n, m, i, j;
        vector pol[50][10];
        vector find[10];
        int num;
        int bx, by;
        scanf("%d", &n);
        if(n == 0)
            break;
        scanf("%d", &m);
        num = m;
        scanf("%d %d", &bx, &by);
        for(j = 1; j < m; j++){
            int tx, ty;
            scanf("%d %d", &tx, &ty);
            find[j].x = tx - bx;
            find[j].y = ty - by;
            bx = tx;
            by = ty;
        }

        vector rpol[50][10];
        int nums[50];
        for(i = 0; i < n; i++){
            scanf("%d", &m);
            nums[i] = m;
            scanf("%d %d", &bx, &by);
            for(j = 1; j < m; j++){
                int tx, ty;
                scanf("%d %d", &tx, &ty);
                pol[i][j].x = tx - bx;
                pol[i][j].y = ty - by;
                rpol[i][m - j].x = bx - tx;
                rpol[i][m - j].y = by - ty;
                bx = tx;
                by = ty;
            }
        }

        //printf("pol find:\n");
        //for(j = 1; j < num; j++)
        //    printf("(%d, %d)\n", find[j].x, find[j].y);
        //printf("\n");
        //for(i = 0; i < n; i++){
        //    printf("pol no %d:\n", i + 1);
        //    for(j = 1; j < nums[i]; j++){
        //        printf("(%d, %d)\n", pol[i][j].x, pol[i][j].y);
        //    }
        //    printf("\n");
        //}

        //for(i = 0; i < n; i++){
        //    printf("rpol no %d:\n", i + 1);
        //    for(j = 1; j < nums[i]; j++){
        //        printf("(%d, %d)\n", rpol[i][j].x, rpol[i][j].y);
        //    }
        //    printf("\n");
        //}
        for(i = 0; i < n; i++){
            if(num == nums[i]){
                for(j = 1; j < num; j++){
                    int f_len = find[j].x + find[j].y;
                    int p_len = pol[i][j].x + pol[i][j].y;
                    if(f_len < 0)
                        f_len *= -1;
                    if(p_len < 0)
                        p_len *= -1;
                    if(f_len != p_len)
                        break;
                }

                int t = j;
                for(j = 2; j < num && t == num; j++){
                    int f_temp = find[j].x * find[j - 1].y - find[j - 1].x * find[j].y;
                    int p_temp = pol[i][j].x * pol[i][j - 1].y - pol[i][j - 1].x * pol[i][j].y;
                    if(f_temp != p_temp)
                        break;
                }
                if(j == num){
                    printf("%d\n", i + 1);
                    continue;
                }

                for(j = 1; j < num; j++){
                    int f_len = find[j].x + find[j].y;
                    int r_len = rpol[i][j].x + rpol[i][j].y;
                    if(f_len < 0)
                        f_len *= -1;
                    if(r_len < 0)
                        r_len *= -1;
                    if(f_len != r_len)
                        break;
                }
                if(j != num)
                    continue;

                for(j = 2; j < num; j++){
                    int f_temp = find[j].x * find[j - 1].y - find[j - 1].x * find[j].y;
                    int r_temp = rpol[i][j].x * rpol[i][j - 1].y - rpol[i][j - 1].x * rpol[i][j].y;
                    if(f_temp != r_temp)
                        break;
                }
                if(j == num){
                    printf("%d\n", i + 1);
                }
            }
        }

        printf("+++++\n");
    }

    return 0;
}

Measured memory_bytes: 620