#include<stdio.h>
#include<stdlib.h>

int main(void)
{

	int i,j,k,c;
	int n,m,m0;
	int **x,**y;
	int *tmp;
	
	while(1)
		{

			scanf("%d",&n);
			if(n==0)
				{
					break;
				}
			
			x = (int **)malloc(sizeof(int *)*(n+1));
			y = (int **)malloc(sizeof(int *)*(n+1));
			
			scanf("%d",&m0);
		
			x[0] = (int *)malloc(sizeof(int)*m0);
			y[0] = (int *)malloc(sizeof(int)*m0);
		
			for(i=0;i<m0;i++)
				{
					scanf("%d %d",&x[0][i],&y[0][i]);
				}
			for(i=0;i<m0;i++)
				{
					x[0][m0-1-i]-=x[0][0];
					y[0][m0-1-i]-=y[0][0];
				}

			for(i=1;i<=n;i++)
				{
					scanf("%d",&m);
					
					x[i] = (int *)malloc(sizeof(int)*m);
					y[i] = (int *)malloc(sizeof(int)*m);
					tmp = (int *)malloc(sizeof(int)*m);
					
					for(j=0;j<m;j++)
						{
							scanf("%d %d",&x[i][j],&y[i][j]);
						}
						
					if(m0 == m)
						{	
							c = 4;
						  while(c--)
								{  
									for(j=0;j<m;j++)
						        {
											x[i][m-1-j]-=x[i][0];
											y[i][m-1-j]-=y[i][0];
										}

									for(k=0;k<m;k++)
										{
											if(x[i][k] != x[0][k] || y[i][k] != y[0][k])
												{break;}
										}
									if(k == m){printf("%d\n",i);break;}
									
									for(j=0;j<m;j++)
						        {
											x[i][j]-=x[i][m-1];
											y[i][j]-=y[i][m-1];
										}

									for(k=0;k<m;k++)
										{
											if(x[i][m-1-k] != x[0][k] || y[i][m-1-k] != y[0][k])
												{break;}
										}

									if(k == m){printf("%d\n",i);break;}
									for(j=0;j<m;j++)
										{
											tmp[j] = x[i][j];
											x[i][j] = y[i][j];
											y[i][j] = -1*tmp[j];
										}
							  }
						}
				}
			printf("+++++\n");
		}
	return 0;
}