#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};
 
    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}
 
#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };
 
    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };
 
    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };
 
    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };
 
    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };
 
    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
 
use std::cmp::Ordering;
use std::cmp;
use std::collections::BTreeMap;
use std::process;
use std::cmp::Ord;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::collections::BTreeSet;
use std::mem;
use std::collections::BinaryHeap;
/// Equivalent to std::lowerbound and std::upperbound in c++
pub struct Scanner<R> {
    stdin: R,
}
 
impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
fn main(){
    let mut c = 0;
    let sssss = std::io::stdin();
    let mut sc = Scanner { stdin: sssss.lock() };
    while(true){
    let mut N:usize = sc.read();
    if N == 0{
        break;
    }
    c+=1;
    let mut v = vec![];
    for i in 0..N+1{
        let mut M:usize = sc.read();
        let mut t=vec![];
        for j in 0..M{
            let mut x:i64 = sc.read();
            let mut y:i64 = sc.read();
            let mut tmp = vec![x as f64, y as f64];
            t.push(tmp);
        }
        v.push(t);
    }
    //println!("{:?}", v);
    let mut res = vec![];
    let pi:f64 = std::f64::consts::PI;
    for i in 1..N+1{
        let mut gf = false;

        for x in 0..4{
            if x%2==0{
                v[0].reverse();
            }
            else{
                v[i].reverse();
            }
        let mut a = vec![ v[0][1][0] - v[0][0][0], v[0][1][1] - v[0][0][1], 0.0];
        let mut b = vec![ v[i][1][0] - v[i][0][0], v[i][1][1] - v[i][0][1], 0.0];
        let mut ab = a[0]*b[0] + a[1]*b[1];
        let mut rate = (a[0]*a[0]+a[1]*a[1]).sqrt() / (b[0]*b[0]+b[1]*b[1]).sqrt();
        let mut flag = true;
        if v[i].len() != v[0].len(){
            continue;
        }




        let mut th = ((ab/ ((a[0]*a[0]+a[1]*a[1]).sqrt()* (b[0]*b[0]+b[1]*b[1]).sqrt())).acos())/(2.0*pi) * 360.0;
        //println!("th:{}", th);
        if a[0]*b[1]-a[1]*b[0]<0.0{
            th -=360.0;
        }
        for j in 2..v[i].len(){
            let mut na = vec![ v[0][j][0] - v[0][j-1][0], v[0][j][1] - v[0][j-1][1], 0.0];
            let mut nb = vec![ v[i][j][0] - v[i][j-1][0], v[i][j][1] - v[i][j-1][1], 0.0];
            let mut nab = na[0]*nb[0] + na[1]*nb[1];
            let mut nrate = (na[0]*na[0]+na[1]*na[1]).sqrt() / (nb[0]*nb[0]+nb[1]*nb[1]).sqrt();
            let mut nth = ((nab/ ((na[0]*na[0]+na[1]*na[1]).sqrt()* (nb[0]*nb[0]+nb[1]*nb[1]).sqrt())).acos())/(2.0*pi) * 360.0;
            if na[0]*nb[1]-na[1]*nb[0]<0.0{
                nth -=360.0;
            }
            if nth-eps<=th && th<=nth+eps && nrate-eps<=rate&&rate<=nrate+eps{
            }
            else{
                flag = false;
            }
            //println!("{} {} {} {} {}", i, th, nth, rate, nrate);
        }

        if flag{gf = true;}



        }
        if gf{
            res.push(i);
        }

    }
    for i in 0..res.len(){
        println!("{}", res[i]);
    }
    println!("+++++");
    }

}

pub static MOD:i64 = 1000000007;
pub static MODu:usize = 1000000007;
pub static eps:f64 = 1e-8;
const INF: i64 = 1 << 60;






Measured memory_bytes: 5148