using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Contest
{
    class Program
    {
        static int Main(string[] args)
        {
            new Program().Process();

            return 0;
        }

        private CommonInput cin;

        private void Process()
        {
            cin = new CommonInput();

            int n, m;

            List<Point> basePoli1;
            List<Point> basePoli2;
            List<Point> poli;

            while (true)
            {
                n = cin.GetNextToInt();

                if (n == 0)
                    break;

                basePoli1 = new List<Point>();
                basePoli2 = new List<Point>();
                poli = new List<Point>();

                m = cin.GetNextToInt();
                int px, py;
                px = cin.GetNextToInt();
                py = cin.GetNextToInt();
                basePoli1.Add(new Point(0, 0));
                for (int i = 1; i < m; i++)
                {
                    basePoli1.Add(new Point(cin.GetNextToInt() - px, cin.GetNextToInt() - py));
                }

                for (int i = m - 1; i >= 0; i--)
                {
                    basePoli2.Add(new Point(basePoli1[i].X - basePoli1[m - 1].X, basePoli1[i].Y - basePoli1[m - 1].Y));
                }

                for (int i = 1; i <= n; i++)
                {
                    m = cin.GetNextToInt();
                    poli.Clear();

                    px = cin.GetNextToInt();
                    py = cin.GetNextToInt();
                    poli.Add(new Point(0, 0));
                    for (int j = 1; j < m; j++)
                    {
                        poli.Add(new Point(cin.GetNextToInt() - px, cin.GetNextToInt() - py));
                    }

                    if (Check(basePoli1, poli) || Check(basePoli2, poli))
                    {
                        Console.WriteLine(i);
                    }
                }

                Console.WriteLine("+++++");
            }
        }

        private bool Check(List<Point> basePoli, List<Point> poli)
        {
            bool isOk = false;
            Point tmpPoint;
            int[] cos = new int[4] { 1, 0, -1, 0 };
            int[] sin = new int[4] { 0, 1, 0, -1 };

            if (basePoli.Count == poli.Count)
            {
                for (int i = 0; !isOk && i < 4; i++)
                {
                    isOk = true;
                    for (int j = 0; isOk && j < basePoli.Count; j++)
                    {
                        tmpPoint = new Point(cos[i] * basePoli[j].X - sin[i] * basePoli[j].Y, sin[i] * basePoli[j].X + cos[i] * basePoli[j].Y);
                        isOk &= tmpPoint.X == poli[j].X && tmpPoint.Y == poli[j].Y;
                    }
                }
            }

            return isOk;
        }
    }

    public struct Point
    {
        public Point(int x, int y)
        {
            this._x = x;
            this._y = y;
        }

        private int _x;

        public int X
        {
            get { return _x; }
            set { _x = value; }
        }

        private int _y;

        public int Y
        {
            get { return _y; }
            set { _y = value; }
        }

    }

    public class CommonInput
    {
        public CommonInput()
        {
            this._s = new string[0];
            this._i = 0;
        }

        public string Line { get; set; }
        private string[] _s;
        private int _i;
        private char[] _sep = { ' ' };

        public void GetLine()
        {
            this._i = 0;
            do
            {
                this.Line = Console.ReadLine();
            } while (this.Line == "");

            if (this.Line != null)
                this._s = this.Line.Split(this._sep, StringSplitOptions.RemoveEmptyEntries);
        }

        public string GetNext()
        {
            if (this._i < this._s.Length)
                return this._s[this._i++];

            this.GetLine();

            return this._s[this._i++];
        }

        public int GetNextToInt()
        {
            return int.Parse(this.GetNext());
        }

        public long GetNextToLong()
        {
            return long.Parse(this.GetNext());
        }

        public double GetNextToDouble()
        {
            return double.Parse(this.GetNext());
        }
    }
}

Measured memory_bytes: 9452