#include <stdio.h>
#include <vector>
#include <utility>

#define rep(i, n) for(int i=0; i<(int)(n); i++)
using namespace std;

vector<pair<int, int> > v[8];

bool match(const vector<pair<int, int> >& v, const vector<pair<int, int> >& p) {
	if(v.size()!=p.size()-1) return false;
	rep(i, v.size()) {
		if(v[i].first!=p[i+1].first-p[i].first
				|| v[i].second!=p[i+1].second-p[i].second)
			return false;
	}
	return true;
}

int main() {
	for(;;) {
		int n;
		scanf("%d", &n);
		if(n==0) return 0;
		vector<pair<int, int> > o;
		rep(i, 8) v[i].clear();
		int m;
		scanf("%d", &m);
		rep(i, m) {
			int x, y;
			scanf("%d%d", &x, &y);
			o.push_back(make_pair(x, y));
		}
		rep(i, m) if(i!=0) {
			int x = o[i].first-o[i-1].first;
			int y = o[i].second-o[i-1].second;
			v[0].push_back(make_pair(x, y));
			v[1].push_back(make_pair(y, -x));
			v[2].push_back(make_pair(-x, -y));
			v[3].push_back(make_pair(-y, x));
			int rx = o[m-i-1].first-o[m-i].first;
			int ry = o[m-i-1].second-o[m-i].second;
			v[4].push_back(make_pair(rx, ry));
			v[5].push_back(make_pair(ry, -rx));
			v[6].push_back(make_pair(-rx, -ry));
			v[7].push_back(make_pair(-ry, rx));
		}
		rep(i, n) {
			vector<pair<int, int> > p;
			int m;
			scanf("%d", &m);
			rep(j, m) {
				int x, y;
				scanf("%d%d", &x, &y);
				p.push_back(make_pair(x, y));
			}
			rep(d, 8) {
				if(match(v[d], p)) {
					printf("%d\n", i+1);
					break;
				}
			}
		}
		printf("+++++\n");
	}
}