/*
 * Copyright (c) 2006 Kamo Hiroyasu
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

/*
 *  An answer to ACM/ICPC Domestic Contest 2005 Problem B
 *	Polygonal Line Search
 *
 *  Author: Kamo Hiroyasu <wd@ics.nara-wu.ac.jp>
 */

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

#ifndef MAXNSEG
#define MAXNSEG	10
#endif

struct point {
	int	x, y;
};

bool
operator==(const point &a, const point &b)
{
	return a.x == b.x && a.y == b.y;
}

inline bool
operator!=(const point &a, const point &b)
{
	return !(a == b);
}

typedef vector<point>	polygon;

void	normalize(polygon &);

namespace {
	template<typename Iter>
	inline int
	polygon_equiv_aux(const polygon &p1, Iter i1, Iter i2)
	{
		polygon	q2(i1, i2);
		normalize(q2);
		return p1 == q2;
	}
}

bool
polygon_equiv(const polygon &p1, const polygon &p2)
{
	return p1.size() == p2.size() &&
		(polygon_equiv_aux(p1, p2.begin(), p2.end()) ||
		 polygon_equiv_aux(p1, p2.rbegin(), p2.rend()));
}

namespace {
	class rotate {
	protected:
		int	x0, y0;
		rotate(int x0, int y0) {this->x0 = x0; this->y0 = y0;}
	};
	
	class rotate0 : public rotate {
	public:
		rotate0(int x0, int y0) : rotate(x0, y0) {}
		void	operator()(point &p)
		{
			p.x -= x0;
			p.y -= y0;
		}
	};

	class rotate270 : public rotate {
	public:
		rotate270(int x0, int y0) : rotate(x0, y0) {}
		void	operator()(point &p)
		{
			int	x = p.y - y0;
			int	y = x0 - p.x;
			p.x = x;
			p.y = y;
		}
	};

	class rotate180 : public rotate {
	public:
		rotate180(int x0, int y0) : rotate(x0, y0) {}
		void	operator()(point &p)
		{
			p.x = x0 - p.x;
			p.y = y0 - p.y;
		}
	};

	class rotate90 : public rotate {
	public:
		rotate90(int x0, int y0) : rotate(x0, y0) {}
		void	operator()(point &p)
		{
			int	x = y0 - p.y;
			int	y = p.x - x0;
			p.x = x;
			p.y = y;
		}
	};
}

void
normalize(polygon &p)
{
	int	x0 = p[0].x;
	int	y0 = p[0].y;
	int	x1 = p[1].x;
	int	y1 = p[1].y;
	if (x1 > x0 && y1 == y0) {
		for_each(p.begin(), p.end(), rotate0(x0, y0));
	} else if (x1 == x0 && y1 > y0) {
		for_each(p.begin(), p.end(), rotate270(x0, y0));
	} else if (x1 < x0 && y1 == y0) {
		for_each(p.begin(), p.end(), rotate180(x0, y0));
	} else if (x1 == x0 && y1 < y0) {
		for_each(p.begin(), p.end(), rotate90(x0, y0));
	}
}

istream &
operator>>(istream &is, polygon &p)
{
	int	n;
	if (!(is >> n) || n < 0 || n > MAXNSEG) {
		return is;
	}
	for (int i = 0; i < n; ++ i) {
		point	a;
		is >> a.x >> a.y;
		p.push_back(a);
	}
	return is;
}

int
main_loop(istream &is)
{
	int		n;
	while (is >> n && n > 0) {
		polygon	p0;
		is >> p0;
		normalize(p0);
		for (int i = 1; i <= n; ++ i) {
			polygon	pi;
			is >> pi;
			if (polygon_equiv(p0, pi)) {
				cout << i << endl;
			}
		}
		cout << "+++++\n";
	}
	return 0;
}

int
main(int argc, char *argv[])
{
	main_loop(cin);
	return 0;
}
