#include<iostream>
#include<complex>
#include<utility>
#include<vector>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
using namespace std;
typedef pair<int,int> pii;
typedef complex<double> point;

point rot[4]={point(1,0),point(0,1),point(-1,0),point(0,-1)};

int main(){
	int n;
	while(cin>>n,n){
		int m,x,y,ans=0;
		vector<vector<pii> > in(n+1);
		vector<vector<point> > vec(n+1);
		rep(i,n+1){
			cin>>m;
			rep(j,m){
				cin>>x>>y;
				in[i].pb(pii(x,y));
			}
		}
		rep(i,n+1){
			rep(j,in[i].size()-1){
				vec[i].pb(point(in[i][j+1].first-in[i][j].first,in[i][j+1].second-in[i][j].second));
			}
		}
		rep(j,n+1){
			if(j==0 || vec[0].size()!=vec[j].size())continue;
			bool boo[8]={1,1,1,1,1,1,1,1};
			rep(k,4){
				bool temp=true;
				rep(l,vec[0].size()){
					point alt=vec[0][l];
					alt*=rot[k];
					if(alt!=vec[j][l]){
						temp=false;
						break;
					}
				}
				if(!temp)boo[k]=false;
				temp=true;
				for(int l=vec[0].size()-1;l>=0;l--){
					point alt=vec[0][vec[0].size()-l-1];
					alt*=rot[k];
					if(alt!=vec[j][l]){
						temp=false;
						break;
					}	
				}
				if(!temp)boo[k+4]=false;
			}
			if(boo[0]||boo[1]||boo[2]||boo[3]||boo[4]||boo[5]||boo[6]||boo[7]){
				cout<<j<<endl;
			}
		}
		cout<<"+++++"<<endl;
	}
	return 0;
}