#include <bits/stdc++.h>

using namespace std;

void rotate(int *x, int *y, int n)
{
    for (int i = 0; i < n; i++){
        int nx = -y[i], ny = x[i];
        x[i] = nx;
        y[i] = ny;
    }
}

bool check(int *x, int *y, int *x2, int *y2, int n)
{
    for (int i = 0; i < n - 1; i++){
        if (x[i + 1] - x[i] != x2[i + 1] - x2[i]) return (false);
        if (y[i + 1] - y[i] != y2[i + 1] - y2[i]) return (false);
    }
    
    return (true);
}

int main()
{
    int n;
    
    while (scanf("%d", &n) && n){
        int m;
        int x[64], y[64];
        
        scanf("%d", &m);
        for (int i = 0; i < m; i++){
            scanf("%d %d", x + i, y + i);
            if (i){
                x[i] -= x[0];
                y[i] -= y[0];
            }
        }
        x[0] = y[0] = 0;
        
        for (int T = 1; T <= n; T++){
            int ms;
            int xs[64], ys[64];
            
            scanf("%d", &ms);
            
            for (int i = 0; i < ms; i++){
                scanf("%d %d", xs + i, ys + i);
                if (i){
                    xs[i] -= xs[0];
                    ys[i] -= ys[0];
                }
            }
            xs[0] = ys[0] = 0;
            
            bool ok = false;
            
            if (ms == m){
                for (int i = 0; i < 4; i++){
                    ok |= check(x, y, xs, ys, m);
                    
                    reverse(xs, xs + ms);
                    reverse(ys, ys + ms);
                    ok |= check(x, y, xs, ys, m);
                    
                    reverse(xs, xs + ms);
                    reverse(ys, ys + ms);
                    rotate(xs, ys, ms);
                }
            }
            
            if (ok){
                printf("%d\n", T);
            }
        }
        
        printf("+++++\n");
    }
    
    return (0);
}