#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <climits>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
vector<int> input(){
	int m;
	cin >> m;
	vector<int> x(m),y(m);
	vector<int> ret;
	for(int i=0;i<m;i++)cin >> x[i] >> y[i];
	for(int i=1;i<m;i++){
		ret.pb(abs(x[i]-x[i-1])+abs(y[i]-y[i-1]));
		if(i<m-1){
			int cross = (x[i+1]-x[i])*(y[i]-y[i-1])-(y[i+1]-y[i])*(x[i]-x[i-1]);
			if(cross>0)ret.pb(1);
			else ret.pb(0);
		}
	}
	return ret;
}
bool same(vector<int> a,vector<int> b){
	if(a.size()!=b.size())return false;
	bool flag = true;
	for(int i=0;i<a.size();i++){
		if(a[i]!=b[i]){
			flag = false;
			break;
		}
	}
	if(flag)return true;
	flag = true;
	int len = (int)a.size();
	int d = (len+1)/2;
	for(int i=0;i<d;i++){
		if(a[2*i]!=b[len-1-(2*i)]){
			flag = false;
			break;
		}
	}
	if(!flag)return false;
	for(int i=0;i<d-1;i++){
		if(a[2*i+1]==b[len-1-(2*i+1)]){
			flag = false;
			break;
		}
	}
	if(!flag)return false;
	else return true;
}
int solve(){
	int n;
	cin >> n;
	if(!n)return 1;
	vector<vector<int> > L(n+1,vector<int>());
	for(int i=0;i<=n;i++)L[i] = input();
	for(int i=1;i<=n;i++){
		if(same(L[0],L[i]))printf("%d\n",i);
	}
	printf("+++++\n");
	return 0;
}
int main(){
	while(!solve()){}
	return 0;
}