#include <bits/stdc++.h>
using namespace std;
using ll=long long;

#define itn long long
#define rep(i,n) for(int i=0;i<(int)n;++i)
#define rrep(i,n) for(int i=(int)(n);i>=0;--i)
#define debug(x) cout << #x << "=" << (x) << endl;
const ll MOD=1e9+7;

template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> void fail(T v){cout << v << endl;exit(0);}
//template end
void nol(vector<pair<int,int>>& p){
  for(int i=1;i<p.size();i++){
      p[i].first-=p[0].first;
      p[i].second-=p[0].second;
    }
    p[0]=make_pair(0,0);
}
void rot(vector<pair<int,int>>& p){
  rep(i,p.size()){
    swap(p[i].first,p[i].second);
    p[i].second*=-1;
  }
}
void solve(){
  while(1){
    int n;
    cin>>n;
    if(!n)return;
    int m;
    cin>>m;
    vector<pair<int,int>> base(m);
    rep(i,m){
      int a,b;
      cin>>a>>b;
      base[i]=make_pair(a,b);
    }
    nol(base);
    for(int i=1;i<=n;i++){
      cin>>m;
      vector<pair<int,int>> p(m);
      rep(i,m){
        int a,b;
        cin>>a>>b;
        p[i]=make_pair(a,b);
      }
      if(m!=base.size())continue;
      nol(p);
      rep(_,4){
        int a=0;
        for(int i=2;i<m;i++){
          if(base[i].first!=p[i].first)
            a++;
          if(base[i].second!=p[i].second)
            a++;
        }
        if(!a){cout<<i<<endl;goto END;}
        rot(p);
      }
      reverse(p.begin(),p.end());
      nol(p);
      rep(_,4){
        int a=0;
        for(int i=2;i<m;i++){
          if(base[i].first!=p[i].first)
            a++;
          if(base[i].second!=p[i].second)
            a++;
        }
        if(!a){cout<<i<<endl;goto END;}
        rot(p);
      }
      END:;
    }
    cout<<"+++++"<<endl;
  }
}
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  solve();
  return 0;
}
