{-
URL: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1136&lang=jp
?????????: Polygonal_Line_Search
20:34 AC
-}
import Data.Complex
import Control.Applicative
import Control.Monad

data Zigzag = Zigzag [Complex Double] -- ????????????????????????

instance Eq Zigzag where
 c@(Zigzag a) == d@(Zigzag b)
  | a==b = True
  | (fromZigzag . zigzag . reverse . fromZigzag)c == fromZigzag d = True
  | otherwise = False


instance Show Zigzag where
 show a = "zigzag " ++ show (fromZigzag a)

zigzag :: [Complex Double] -> Zigzag
zigzag [] = undefined
zigzag (a:xs) = Zigzag $ map (/signum(head b)) b
 where b = map (subtract a) xs


fromZigzag :: Zigzag -> [Complex Double]
fromZigzag (Zigzag a) = 0:a

main = do
 n <- read <$> getLine
 unless (n==0) $ do
  zigzags <- replicateM (n+1) getZigzag
  let ans = tail{-0?????????-}. map fst . filter ((==head zigzags) . snd) $ zip [0..] zigzags --index?????£??????zigzag????????????????????????filter
  mapM_ print ans
  putStrLn "+++++"
  main

getZigzag :: IO Zigzag
getZigzag = do
 m <- read <$> getLine
 zigzag <$> replicateM m (fmap lire getLine)


lire :: String -> Complex Double
lire str = let[a,b] = map read $ words str in a:+b