fun main(args: Array<String>?): Unit {
    while (true) {
        val n = readLine()!!.trim().toInt()
        if (n == 0) break
        val lines = Array(n + 1) {
            val m = readLine()!!.trim().toInt()
            val points = Array(m) {
                val (x, y) = readLine()!!.trim().split(' ').map(String::toInt)
                Point(x, y)
            }
            PolygonalLine(points)
        }
        (1..n).filter { lines.first().isSame(lines[it]) }.forEach { println(it) }
        println("+++++")
    }
}

data class Point(val x: Int, val y: Int) {
    fun rotate90(): Point = Point(-y, x)
    operator fun plus(that: Point): Point = Point(x + that.x, y + that.y)
    operator fun minus(that: Point): Point = Point(x - that.x, y - that.y)
}
class PolygonalLine(initial: Array<Point>) {
    private val points: Array<Point>
    private val reversed: Array<Point>
    init {
        points = normalize(initial)
        reversed = normalize(initial.reversedArray())
    }
    fun isSame(that: PolygonalLine): Boolean {
        if (points.size != that.points.size) return false
        return points.indices.all{points[it] == that.points[it]} ||
                points.indices.all{points[it] == that.reversed[it]} ||
                reversed.indices.all{reversed[it] == that.points[it]} ||
                reversed.indices.all{reversed[it] == that.reversed[it]}
    }
    companion object {
        private fun normalize(points: Array<Point>): Array<Point> {
            var shifted = points.map{it - points.first()}
            while (shifted[1].x <= 0 || shifted[1].y < 0) {
                shifted = shifted.map(Point::rotate90)
            }
            return shifted.toTypedArray()
        }
    }
}
