Go: // Keitai Message
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=2006&lang=jp
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var table = []string{
	"",
	".,!? ",
	"abc",
	"def",
	"ghi",
	"jkl",
	"mno",
	"pqrs",
	"tuv",
	"wxyz",
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	n := nextInt(sc)

	for i := 0; i < n; i++ {
		message := nextString(sc)
		currentButton, count := 0, 0
		for _, word := range message {
			// 確定の処理を書く
			if word == '0' {
				if currentButton == 0 {
					count = 0
					continue
				}
				mod := len(table[currentButton])
				tmp := table[currentButton][(count-1)%mod]
				currentButton, count = 0, 0
				fmt.Printf("%c", tmp)
			} else {
				count++
				currentButton = int(word) - 48 // '0'はASCIIで48
			}
		}
		fmt.Println()
	}
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

Python: d = {'1': ['.', ',', '!', '?', ' '], '2': ['a', 'b', 'c'], '3': ['d', 'e', 'f'], '4': ['g', 'h', 'i'], '5': ['j', 'k', 'l'], '6': ['m', 'n', 'o'], '7': ['p', 'q', 'r', 's'], '8': ['t', 'u', 'v'], '9': ['w', 'x', 'y', 'z']}

n = int(input())
m = [input() for i in range(n)]
for mm in m:
    l = [x for x in mm.split('0') if not x == '']
    buf = ''
    for x in l:
        buf += d[x[0]][len(x)%len(d[x[0]]) - 1]
    print(buf)

Python: # AOJ 2006: Keitai Message
# Python3 2018.6.20 bal4u

tbl = [0, ".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"]

for _ in range(int(input())):
	ans = []
	s, i = list(input()), 0
	while i < len(s):
		if s[i] != '0':
			id, k = int(s[i]), 0
			i += 1
			while s[i] != '0':
				i += 1
				k += 1
			ans.append(tbl[id][k % len(tbl[id])]);
		i += 1
	print(*ans, sep='')

Python: d = {'1': ['.', ',', '!', '?', ' '], '2': ['a', 'b', 'c'], '3': ['d', 'e', 'f'], '4': ['g', 'h', 'i'], '5': ['j', 'k', 'l'], '6': ['m', 'n', 'o'], '7': ['p', 'q', 'r', 's'], '8': ['t', 'u', 'v'], '9': ['w', 'x', 'y', 'z']}

n = int(input())
m = [input() for i in range(n)]
for mm in m:
    l = [x for x in mm.split('0') if not x == '']
    for x in l:
        print(d[x[0]][len(x)%len(d[x[0]]) - 1])
    print()

Python: from itertools import cycle as c

n=int(input())
for _ in range(n):
  t=input()
  l=[]
  bf=""
  for nn in map(int,t):
    if not nn:
      l.extend([bf])
      bf=""
      continue
    if not bf:
      if nn:
        kl=[
          c(".,!? "),
          c("abc"),
          c("def"),
          c("ghi"),
          c("jkl"),
          c("mno"),
          c("pqrs"),
          c("tuv"),
          c("wxyz")
        ]
        bf=next(kl[nn-1])
    else:
      bf=next(kl[nn-1])
  print("".join(l))

Python: N = int(input())
d = []
d.append([])
d.append([".",",","!","?"])
d.append(["a","b","c"])
d.append(["d","e","f"])
d.append(["g","h","i"])
d.append(["j","k","l"])
d.append(["m","n","o"])
d.append(["p","q","r","s"])
d.append(["t","u","v"])
d.append(["w","x","y","z"])
for _ in range(N):
    nn = input()
    output = ""
    b = 0
    c = 0
    for n in nn:
        n = int(n)
        if n == 0:
            output += d[b][c]
            c = 0
        b = n

Python: def solve():
    from sys import stdin
    f_i = stdin
    
    buttons = {
            '1': ".,!? ",
            '2': "abc",
            '3': "def",
            '4': "ghi",
            '5': "jkl",
            '6': "mno",
            '7': "pqrs",
            '8': "tuv",
            '9': "wxyz",
            }
    
    n = int(f_i.readline())
    
    ans = ""
    
    for i in range(n):
        code = f_i.readline().rstrip().split('0')
        
        for c in filter(lambda x: x != '', code):
            btn_chars = buttons[c[0]]
            idx = (len(c) - 1) % len(btn_chars)
            ans += btn_chars[idx]
            
        ans += '\n'
        
    print(ans, end='')

solve()

Python: n = int(input())
abc = [".,!? ", "abc", "def", "ghi", "jkl", "mno", "pqrs", "tuv", "wxyz"]
for i in range(n):
  s = input()
  ans = ""
  cur = -1
  num = -1
  for e in s:
    e = int(e)
    if cur ==-1 and e==0:
      continue
    elif e==0:
      t = len(abc[cur-1])
      ans += abc[cur-1][num%t]
      num = -1
      cur = -1
    else:
      cur = e
      num += 1
  print(ans)

Python: lists = [[".",",","!","?"," "],["a","b","c"],["d","e","f"],["g","h","i"],["j","k","l"],["m","n","o"],["p","q","r","s"],["t","u","v"],["w","x","y","z"]]
cnt = 0
moji = []
ans = []
n = int(input())
for k in range(n):
    s = str(input())
    for i in range(len(s)):
        if s[i] != "0":
            cnt += 1
            tmp = int(s[i])
            if cnt > len(lists[tmp-1]):
                cnt = cnt - len(lists[tmp-1]) 
            
        elif s[i] == "0" and cnt != 0:
                moji.append(lists[tmp - 1][int(cnt)-1])
                cnt = 0
    mojimoji = "".join(moji)
    ans.append(mojimoji)
    moji = []
for i in ans:
    print(i)

Python: chars = (None, '.,!? ', 'abc', 'def', 'ghi', 'jkl', 'mno', 'pqrs', 'tuv', 'wxyz')
n = int(input())

while n:
    n -= 1
    s = input()
    number, counter = 0, 0
    for c in s:
        if c == '0':
            if number:
                charset = chars[number]
                print(charset[(counter - 1) % len(charset)], end='')
                number, counter = 0, 0
        elif counter:
            counter += 1
        else:
            number = int(c)
            counter = 1
    print()

Python: if __name__ == '__main__':
    n = int(input())
    moji =[[],[' ','.',',','!','?'],['c','a','b'],['f','d','e'],['i','g','h'],['l','j','k'],['o','m','n'],['s','p','q','r'],['v','t','u'],['z','w','x','y']]
    for _ in range(n):
        line = list(input().strip().replace('0',' ').split())
        ans = []
        for i in line:
            m=int(i[0])
            ans.append(moji[m][len(i)%len(moji[m])])
        print(''.join(ans))

Python: d = {'1': ['.', ',', '!', '?', ' '], '2': ['a', 'b', 'c'], '3': ['d', 'e', 'f'], '4': ['g', 'h', 'i'], '5': ['j', 'k', 'l'], '6': ['m', 'n', 'o'], '7': ['p', 'q', 'r', 's'], '8': ['t', 'u', 'v'], '9': ['w', 'x', 'y', 'z']}

n = int(input())
m = [input() for i in range(n)]
for mm in m:
    l = [x for x in mm.split('0') if not x == '']
    for x in l:
        print(d[x[0]][len(x)%len(d[x[0]]) - 1], end='')
    print()

Python: n = int(input())
string = ["", ".,!? ", "abc", "def", "ghi",
          "jkl", "mno", "pqrs", "tuv", "wxyz"]
for i in range(n):
    s = input()
    count = 0
    num = int(s[0])
    for c, c1 in zip(s, s[1:]):
        if c == c1:
            count += 1
        else:
            if num != 0:
                print(string[num][count % len(string[num])], end="")
            else:
                pass
            num = int(c1)
            count = 0
    print()

Python: d = {"1": [".", ",", "!", "?", " "], "2": ["a", "b", "c"], "3": ["d", "e", "f"],
     "4": ["g", "h", "i"], "5": ["j", "k", "l"], "6": ["m", "n", "o"],
     "7": ["p", "q", "r", "s"], "8": ["t", "u", "v"], "9": ["w", "x", "y", "z"]}

n = int(input())
m = [input() for _ in range(n)]
ans = [[d[cs[0]][len(cs) % len(d[cs[0]]) - 1] for cs in line.split("0") if cs != ""] for line in m]
for a in ans:
    print(*a, sep="")

Python: d = {"1": [".", ",", "!", "?", " "], "2": ["a", "b", "c"], "3": ["d", "e", "f"],
     "4": ["g", "h", "i"], "5": ["j", "k", "l"], "6": ["m", "n", "o"],
     "7": ["p", "q", "r", "s"], "8": ["t", "u", "v"], "9": ["w", "x", "y", "z"]}

n = int(input())
m = [input() for _ in range(n)]
for line in m:
    ans = []
    for cs in line.split("0"):
        if cs == "":
            continue
        index = len(cs) % len(d[cs[0]]) - 1
        ans.append(d[cs[0]][index])
    print("".join(ans))