using System.IO;
using System;
using System.Diagnostics;



namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                
                int n = int.Parse(Console.ReadLine());
                if (n == 0) break;
                int om = int.Parse(Console.ReadLine());
                int[,] otable = new int[om, 2];
                for (int oj = 0; oj < om; oj++)
                {
                    string[] ostr = Console.ReadLine().Split(' ');
                    otable[oj, 0] = int.Parse(ostr[0]);
                    otable[oj, 1] = int.Parse(ostr[1]);
                }
                int[,] revotable = Rev(otable, om);
                int ox = otable[0, 0];
                int oy = otable[0, 1];
                for(int oj = 0; oj < om; oj++)
                {
                    otable[oj, 0] = otable[oj, 0] - ox;
                    otable[oj, 1] = otable[oj, 1] - oy;
                }
                Debug.WriteLine("after reversion");
                ox = revotable[0, 0];
                oy = revotable[0, 1];
                for (int oj = 0; oj < om; oj++)
                {

                    revotable[oj, 0] = revotable[oj, 0] - ox;
                    revotable[oj, 1] = revotable[oj, 1] - oy;
                    
                    Debug.WriteLine(revotable[oj, 0] + " " + revotable[oj, 1]);
                }

                for (int i = 0; i < n; i++)
                {
                    int m = int.Parse(Console.ReadLine());
                    int[,] table = new int[m, 2];
                    for (int j = 0; j < m; j++)
                    {
                        string[] str = Console.ReadLine().Split(' ');
                        table[j, 0] = int.Parse(str[0]);
                        table[j, 1] = int.Parse(str[1]);

                    }
                    // ???????????§??\???
                    int ox2 = table[0, 0];
                    int oy2 = table[0, 1];
                    for (int j = 0; j < m; j++)
                    {
                        table[j, 0] = table[j, 0] - ox2;
                        table[j, 1] = table[j, 1] - oy2;//?????????????????????
                    }

                    if (Checker(otable, table) || Checker(otable, Rot(table, 90)) || Checker(otable, Rot(table, 180)) || Checker(otable, Rot(table, 270))
                        || Checker(revotable, table) || Checker(revotable, Rot(table, 90)) || Checker(revotable, Rot(table, 180)) || Checker(revotable, Rot(table, 270)))
                    {
                        Console.WriteLine(i+1);
                    }
                    

                }
                Console.WriteLine("+++++");
            }
            //otable?????¢???????????????????????????????????§table(n???)????????§otable????????????????????´?????????????????¢????????????
            Console.ReadLine();
        }
        static int[,] Rev(int[,] table, int m) //?????????????§??????¨?????????????????????
        {
            int[,] tmp = new int[m, 2];
            for (int i = 0; i < m; i++)
            {
                tmp[i, 0] = table[m - 1 - i, 0];
                tmp[i, 1] = table[m - 1 - i, 1];
            }
            
            return tmp;
        }
        
        static int[,] Rot(int[,] table,int para) //?????¢?????????
        {
            int temp;
            switch (para)
            {
                case 90:
                    for(int j = 0; j< table.GetLength(0); j++)
                    {
                        temp = table[j, 0];
                        table[j, 0] = -table[j, 1];
                        table[j, 1] = temp;
                    }
                    break;
                case 180:
                    for (int j = 0; j < table.GetLength(0); j++)
                    {
                        table[j, 0] = -table[j, 0];
                        table[j, 1] = -table[j, 1];
                    }
                    break;
                case 270:
                    for(int j = 0; j < table.GetLength(0); j++)
                    {
                        temp = table[j, 0];
                        table[j, 0] = table[j, 1];
                        table[j, 1] = -temp;
                    }
                    break;

            }
            return table;

        }


        static bool Checker(int[,] t1, int[,] t2) //?????´??????????????§??????
        {
            if (t1.GetLength(0) != t2.GetLength(0)) return false;
            bool result = true;
            for (int i = 0; i < t1.GetLength(0); i++)
            {
                if (t1[i, 0] != t2[i, 0] || t1[i, 1] != t2[i, 1]) result = false;            
            }
            return result;
        }
    }
}

Measured memory_bytes: 9356