import Data.List.Split
import Control.Monad.Cont
import Control.Applicative


solve :: String -> String
solve s = let ws = splitOn "0" s
              wss = filter (\x -> x /= "") ws
           in map (\x -> keyToChar x) wss

keyToChar :: []Char -> Char
keyToChar all@(x:xs) = toChar x $ length all

toChar :: Char -> Int -> Char
toChar x n = case x of
               '1' -> solve1 n
               '2' -> solve2 n
               '3' -> solve3 n
               '4' -> solve4 n
               '5' -> solve5 n
               '6' -> solve6 n
               '7' -> solve7 n
               '8' -> solve8 n
               '9' -> solve9 n

solve1 :: Int -> Char
solve1 1 = '.'
solve1 n = iSolve1 n '.'
    where iSolve1 1 s = s
          iSolve1 n s = case s of
                          '.' -> iSolve1 (n-1) ','
                          ',' -> iSolve1 (n-1) '!'
                          '!' -> iSolve1 (n-1) '?'
                          '?' -> iSolve1 (n-1) ' '
                          ' ' -> iSolve1 (n-1) '.'

solve2 :: Int -> Char
solve2 1 = 'a'
solve2 n = iSolve2 n 'a'
    where iSolve2 1 s = s
          iSolve2 n s = case s of
                          'a' -> iSolve2 (n-1) 'b'
                          'b' -> iSolve2 (n-1) 'c'
                          'c' -> iSolve2 (n-1) 'a'
solve3 :: Int -> Char
solve3 1 = 'd'
solve3 n = iSolve3 n 'd'
    where iSolve3 1 s = s
          iSolve3 n s = case s of
                          'd' -> iSolve3 (n-1) 'e'
                          'e' -> iSolve3 (n-1) 'f'
                          'f' -> iSolve3 (n-1) 'd'
solve4 :: Int -> Char
solve4 1 = 'g'
solve4 n = iSolve4 n 'g'
    where iSolve4 1 s = s
          iSolve4 n s = case s of
                          'g' -> iSolve4 (n-1) 'h'
                          'h' -> iSolve4 (n-1) 'i'
                          'i' -> iSolve4 (n-1) 'g'
solve5 :: Int -> Char
solve5 1 = 'j'
solve5 n = iSolve5 n 'j'
    where iSolve5 1 s = s
          iSolve5 n s = case s of
                          'j' -> iSolve5 (n-1) 'k'
                          'k' -> iSolve5 (n-1) 'l'
                          'l' -> iSolve5 (n-1) 'j'
solve6 :: Int -> Char
solve6 1 = 'm'
solve6 n = iSolve6 n 'm'
    where iSolve6 1 s = s
          iSolve6 n s = case s of
                          'm' -> iSolve6 (n-1) 'n'
                          'n' -> iSolve6 (n-1) 'o'
                          'o' -> iSolve6 (n-1) 'm'
solve7 :: Int -> Char
solve7 1 = 'p'
solve7 n = iSolve7 n 'p'
    where iSolve7 1 s = s
          iSolve7 n s = case s of
                          'p' -> iSolve7 (n-1) 'q'
                          'q' -> iSolve7 (n-1) 'r'
                          'r' -> iSolve7 (n-1) 's'
                          's' -> iSolve7 (n-1) 'p'
solve8 :: Int -> Char
solve8 1 = 't'
solve8 n = iSolve8 n 't'
    where iSolve8 1 s = s
          iSolve8 n s = case s of
                          't' -> iSolve8 (n-1) 'u'
                          'u' -> iSolve8 (n-1) 'v'
                          'v' -> iSolve8 (n-1) 't'
solve9 :: Int -> Char
solve9 1 = 'w'
solve9 n = iSolve9 n 'w'
    where iSolve9 1 s = s
          iSolve9 n s = case s of
                          'w' -> iSolve9 (n-1) 'x'
                          'x' -> iSolve9 (n-1) 'y'
                          'y' -> iSolve9 (n-1) 'z'
                          'z' -> iSolve9 (n-1) 'w'
main = do
    ns <- (map read . words) <$> getLine
    let n = ns !! 0
     in forM_ [0..(n-1)] $ \i ->  do
         ss <- getLine
         putStrLn $ solve ss

Measured memory_bytes: 4160