//#include <bits/stdc++.h>
#include<iostream>
#include<stdio.h>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;


int main(void) {
	
	while (1) {
		int n, m[51];
		int dpx[51][11] = {};
		int dpy[51][11] = {};
		int dp[51][11] = {};
		int x[11], y[11];
		vector<bool> check(52, false);

		cin >> n;
		if (n == 0) {
			break;
		}
		cin >> m[0];
		FOR(i, 1, m[0]) {
			cin >> x[i] >> y[i];
			if (i != 1) {
				dpx[0][i] = x[i] - x[i - 1];
				dpy[0][i] = y[i] - y[i - 1];
				dp[0][i] = dpx[0][i] + dpy[0][i];
			}

		}

		FOR(i, 1, n) {
			cin >> m[i];
			FOR(j, 1, m[i]) {
				cin >> x[j] >> y[j];
				if (j != 1) {
					dpx[i][j] = x[j] - x[j - 1];
					dpy[i][j] = y[j] - y[j - 1];
					dp[i][j] = dpx[i][j] + dpy[i][j];
				}
			}
		}

		/*cout << endl;
		FOR(i, 0, n) {
			FOR(j, 1, 5) {
				cout << i << " " << j << " " << dpx[i][j] << " " << dpy[i][j] << " " << dp[i][j] << endl;
			}
			cout << endl;
		}*/


		FOR(i, 1, n) {
			bool res = true;
			if (m[0] != m[i]) {
				continue;
			}


			//順方向
			int flag;// 0,1,2,3,4 同じ、偶数が逆、奇数が逆、すべて逆、エラー
			if (dpx[0][2] != 0) {//最初にx方向に移動
				if (dpx[0][2] == dpx[i][2]) {
					flag = 0;
				}
				else if (dpx[0][2] == -dpx[i][2]) {
					flag = 3;
				}
				else if (dpx[0][2] == dpy[i][2]) {
					flag = 1;
				}
				else if (dpx[0][2] == -dpy[i][2]) {
					flag = 2;
				}
				else {
					flag = 4;
				}
			}
			else {//最初にy方向に移動
				if (dpy[0][2] == dpy[i][2]) {
					flag = 0;
				}
				else if (dpy[0][2] == -dpy[i][2]) {
					flag = 3;
				}
				else if (dpy[0][2] == dpx[i][2]) {
					flag = 1;
				}
				else if (dpy[0][2] == -dpx[i][2]) {
					flag = 2;
				}
				else {
					flag = 4;
				}
			}

			FOR(j, 3, m[0]) {
				switch (flag) {
				case 0:
					if (dp[0][j] != dp[i][j]) {
						res = false;
					}
					break;
				case 1:
					if (j % 2 == 0) {
						if (dp[0][j] != dp[i][j]) {
							res = false;
						}
					}
					else {
						if (dp[0][j] != -dp[i][j]) {
							res = false;
						}
					}
					break;
				case 2:
					if (j % 2 == 0) {
						if (dp[0][j] != -dp[i][j]) {
							res = false;
						}
					}
					else {
						if (dp[0][j] != dp[i][j]) {
							res = false;
						}
					}
					break;
				case 3:
					if (dp[0][j] != -dp[i][j]) {
						res = false;
					}
					break;
				case 4:
					res = false;
				}
				if (!res) {
					break;
				}
			}
			if (res == true) {
				check[i] = true;
			}



			//逆方向
			res = true;
			if (dpx[0][2] != 0) {//最初にx方向に移動
				if (dpx[0][2] == dpx[i][m[0]]) {
					flag = 0;
				}
				else if (dpx[0][2] == -dpx[i][m[0]]) {
					flag = 3;
				}
				else if (dpx[0][2] == dpy[i][m[0]]) {
					flag = 1;
				}
				else if (dpx[0][2] == -dpy[i][m[0]]) {
					flag = 2;
				}
				else {
					flag = 4;
				}
			}
			else {//最初にy方向に移動
				if (dpy[0][2] == dpy[i][m[0]]) {
					flag = 0;
				}
				else if (dpy[0][2] == -dpy[i][m[0]]) {
					flag = 3;
				}
				else if (dpy[0][2] == dpx[i][m[0]]) {
					flag = 1;
				}
				else if (dpy[0][2] == -dpx[i][m[0]]) {
					flag = 2;
				}
				else {
					flag = 4;
				}
			}

			FOR(j, 3, m[0]) {
				switch (flag) {
				case 0:
					if (dp[0][j] != dp[i][m[0] - j + 2]) {
						res = false;
					}
					break;
				case 1:
					if (j % 2 == 0) {
						if (dp[0][j] != dp[i][m[0] - j + 2]) {
							res = false;
						}
					}
					else {
						if (dp[0][j] != -dp[i][m[0] - j + 2]) {
							res = false;
						}
					}
					break;
				case 2:
					if (j % 2 == 0) {
						if (dp[0][j] != -dp[i][m[0] - j + 2]) {
							res = false;
						}
					}
					else {
						if (dp[0][j] != dp[i][m[0] - j + 2]) {
							res = false;
						}
					}
					break;
				case 3:
					if (dp[0][j] != -dp[i][m[0] - j + 2]) {
						res = false;
					}
					break;
				case 4:
					res = false;
				}
				if (!res) {
					break;
				}
			}
			if (res == true) {
				check[i] = true;
			}
		}

		FOR(i, 1, n) {
			if (check[i] == true) {
				cout << i << endl;
			}
		}
		cout << "+++++" << endl;
	}

	return 0;
}


Measured memory_bytes: 3024