#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>

using namespace std;
typedef pair<int, int> Pi;

Pi operator- (Pi a, Pi b) {
	Pi ret;
	ret.first = a.first - b.first;
	ret.second = a.second - b.second;
	return ret;
}

int N;
vector<vector<Pi>> oresen;

int main() {

	while (1) {
		int N;
		cin >> N;
		if (N == 0)break;

		oresen.resize(N + 1);
		for (int i = 0; i < N + 1; i++) {
			int m;
			cin >> m;
			Pi base;
			cin >> base.first >> base.second;
			
			for (int j = 1; j < m; j++) {
				Pi input;
				cin >> input.first >> input.second;
				oresen[i].push_back(input - base);
				base = input;
			}
		}
		
		//比較
		set<int> ans;
		for (int i = 1; i < N + 1; i++) {
			for (int j = 0; j < 2; j++) {
				if (oresen[i].size() != oresen[0].size())goto end;
				if (j == 1) {
					reverse(oresen[0].begin(), oresen[0].end());
				}
				
				for (int k = 0; k < 4; k++) {
					bool f = true;
					for (int j = 0; j < oresen[i].size(); j++) {
						//四方向
						int tmp = oresen[i][j].first;
						oresen[i][j].first = -oresen[i][j].second, oresen[i][j].second = tmp;
						if (oresen[0][j] != oresen[i][j])f = false;
						
					}
					if (f)ans.insert(i);
				}
			end:;

			}

		}

		for (auto i = ans.begin(); i != ans.end(); i++) {
			cout << *i << endl;
		}

		oresen.clear();
		cout << "+++++" << endl;
	}

	return 0;
}
