import           Control.Applicative
import           Control.Monad
import qualified Data.ByteString.Char8 as B

import           Data.Array.IArray

readi :: B.ByteString -> Int
readi b | Just (n, _) <- B.readInt b = n

printList :: Int -> [Int] -> IO ()
printList n xs = putStrLn $ unwords ys
  where
    ys =
        [ if i `elem` xs
            then "1"
            else "0"
        | i <- [1 .. n]
        ]

main :: IO ()
main = do
    n <- readLn
    xss <- fmap (fmap readi . B.words) . B.lines <$> B.getContents
    let f [i, 0]   = (i, [])
        f (i:_:ks) = (i, ks)
    let arr = array (1, n) $ fmap f xss :: Array Int [Int]
    forM_ [1 .. n] $ \i -> printList n $ arr ! i

