#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;

#define DE 1
#define FI first
#define SE second
#define PB push_back
#define MP make_pair
#define ALL(s) (s).begin(),(s).end()
#define REP(i,n) for (int i = 0; i < (int)(n); ++i)
#define EACH(i,s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl

template<class T1, class T2> ostream& operator<<(ostream &s, pair<T1,T2> P){return s<<'<'<<P.first<<", "<<P.second<<'>';}
template<class T> ostream& operator<<(ostream &s, vector<T> P) {s<<"{ ";for(int i=0;i<P.size();++i){if(i>0)s<<", ";s<<P[i];}return s<<" }"<<endl;}
template<class T1, class T2> ostream& operator<<(ostream &s, map<T1,T2> P) {s<<"{ ";for(__typeof__(P.begin()) it=P.begin();it!=P.end();++it){if(it!=P.begin())s<<", ";s<<'<'<<it->first<<"->"<<it->second<<'>';}return s<<" }"<<endl;}
template<class T> pair<T,T> operator+(pair<T,T> P, pair<T,T> Q) {return make_pair(P.first+Q.first,P.second+Q.second);}
template<class T> pair<T,T> operator-(pair<T,T> P, pair<T,T> Q) {return make_pair(P.first-Q.first,P.second-Q.second);}
template<class T1, class T2> pair<T1,T1> operator*(pair<T1,T1> P, T2 a) {return make_pair(P.first*a,P.second*a);}
template<class T> pair<T,T> operator*(pair<T,T> P, pair<T,T> Q) {return make_pair(P.first*Q.first-P.second*Q.second,P.first*Q.second+P.second*Q.first);}



pint dir[4] = {MP(1,0), MP(0,1), MP(-1,0), MP(0,-1)};
vector<pint> input;
map<vector<pint>,int> ma;

int n, m;
int x, y, nx, ny;

int main() {
    //freopen( "/Users/macuser/Documents/Programming/Contest/input.in", "r", stdin );
    
    while (cin >> n) {
        if (n == 0) break;
        
        cin >> m;
        input.clear();
        ma.clear();
        
        cin >> x >> y;
        for (int i = 0; i < m-1; ++i) {
            cin >> nx >> ny;
            pint p = MP(nx-x, ny-y);
            input.PB(p);
            x = nx, y = ny;
        }
        for (int i = 0; i < 4; ++i) {
            vector<pint> temp = input;
            for (int j = 0; j < input.size(); ++j) {
                temp[j] = temp[j] * dir[i];
            }
            ma[temp]++;
            //COUT(temp);
            
            reverse(ALL(temp));
            for (int j = 0; j < input.size(); ++j) {
                temp[j] = temp[j] * -1;
            }
            ma[temp]++;
            //COUT(temp);
        }
        //COUT(ma);
        
        for (int i = 0; i < n; ++i) {
            cin >> m;
            cin >> x >> y;
            vector<pint> inst;
            for (int i = 0; i < m-1; ++i) {
                cin >> nx >> ny;
                pint p = MP(nx-x, ny-y);
                inst.PB(p);
                x = nx, y = ny;
            }
            if (ma[inst] > 0) {
                cout << i+1 << endl;
            }
        }
        
        cout << "+++++" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 1212