import Control.Monad
import qualified Data.List as L

main :: IO ()
main = do
    n <- read <$> getLine :: IO Int
    when (n /= 0) $ solve n

type PolyLine = [(Int, Int)]

getPolyLine :: IO PolyLine
getPolyLine = do
    n <- read <$> getLine :: IO Int
    replicateM n $ do
        [a, b] <- map read . words <$> getLine :: IO [Int]
        return (a, b)

lrs :: PolyLine -> String
lrs ((x,y):(x',y'):(x'',y''):l) = case (x==x', x<x', y<y', y'<y'', x'<x'') of
    (True,  _, b, _, True)  -> (if b then 'R' else 'L') : lrs ((x',y'):(x'',y''):l)
    (True,  _, b, _, False) -> (if b then 'L' else 'R') : lrs ((x',y'):(x'',y''):l)
    (False, b, _, True, _)  -> (if b then 'L' else 'R') : lrs ((x',y'):(x'',y''):l)
    (False, b, _, False, _) -> (if b then 'R' else 'L') : lrs ((x',y'):(x'',y''):l)
lrs _ = []

rev = map (\c -> if c == 'R' then 'L' else 'R') . reverse

solve :: Int -> IO ()
solve n = do
    basePolyLine <- lrs <$> getPolyLine :: IO String
    polyLines <- map fst 
        . filter (\(_, p) -> basePolyLine == p || rev basePolyLine == p) 
        . zip [1..] 
        . map lrs 
        <$> replicateM n getPolyLine :: IO [Int]
    mapM_ print polyLines
    putStrLn "+++++"
    main
