#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

void transposition(vector<P> &v){
    for(int i=0; i<v.size(); i++){
        v[i] = P{v[i].second, -v[i].first};
    }
    return;
}

bool check(vector<P> v, vector<P> u){
    bool same = true;
    int dx = v[0].first - u[0].first;
    int dy = v[0].second - u[0].second;
    if(v.size() != u.size()) return false;
    for(int i=0; i<v.size(); i++){
        if(v[i].first != u[i].first + dx || v[i].second != u[i].second + dy) same = false;
    }
    return same;
}

void solve(int n){
    int m;
    cin >> m;
    vector<P> origin(m);
    for(int i=0; i<m; i++) cin >> origin[i].first >> origin[i].second;
    for(int N=0; N<n; N++){
        vector<P> v;
        bool same = false;
        cin >> m;
        for(int i=0; i<m; i++){
            int x, y;
            cin >> x >> y;
            v.push_back(P{x, y});
        }

        for(int i=0; i<2; i++){
            for(int j=0; j<4; j++){
                same |= check(origin, v);
                transposition(v);
            }
            reverse(v.begin(), v.end());
        }
        if(same == true) cout << N+1 << endl;
    }
    return;
}


int main(){
    int n;
    while(true){
        cin >> n;
        if(n == 0) return 0;
        solve(n);
        cout << "+++++" << endl;
    }
}
