import Data.Array.IO
import Control.Monad

main = do
  n <- getLine
  ary <- newArray ((0,0,0),(3,2,9)) 0 :: IO (IOArray (Int,Int,Int) Int)
  forM_ [1..read n] $ \i -> do
    m <- getLine
    let [b,f,r,v] = map (read :: String->Int) . words $ m
    vOld <- readArray ary (b-1,f-1,r-1)
    writeArray ary (b-1,f-1,r-1) (vOld+v)

  forM_ [0..3] $ \i -> do
      forM_ [0..2] $ \j -> do
          forM_ [0..9] $ \k -> do
            vNew <-  readArray ary (i,j,k)
            putStr $ " " ++ show vNew
          putStrLn ""
      if i < 3 then putStrLn "####################" else return ()