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()
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin>>n;
    string s;
    for (int i=0;i<n;i++) {
        cin>>s;
        int j=0;
        while (j<s.size()) {
            int count=0;
            if (s.at(j)=='1') {
                while (s.at(j)!='0') {
                    count++;
                    if (count==6) {
                        count-=5;
                    }
                    j++;
                }
                if (count==1) {
                    cout<<".";
                } else if (count==2) {
                    cout<<",";
                } else if (count==3) {
                    cout<<"!";
                } else if (count==4) {
                    cout<<"?";
                } else if (count==5) {
                    cout<<" ";
                }
            } else if (s.at(j)=='2') {
                while (s.at(j)!='0') {
                    count++;
                    if (count==4) {
                        count-=3;
                    }
                    j++;
                }
                if (count==1) {
                    cout<<"a";
                } else if (count==2) {
                    cout<<"b";
                } else if (count==3) {
                    cout<<"c";
                }
            } else if (s.at(j)=='3') {
                while (s.at(j)!='0') {
                    count++;
                    if (count==4) {
                        count-=3;
                    }
                    j++;
                }
                if (count==1) {
                    cout<<"d";
                } else if (count==2) {
                    cout<<"e";
                } else if (count==3) {
                    cout<<"f";
                }
            } else if (s.at(j)=='4') {
                while (s.at(j)!='0') {
                    count++;
                    if (count==4) {
                        count-=3;
                    }
                    j++;
                }
                if (count==1) {
                    cout<<"g";
                } else if (count==2) {
                    cout<<"h";
                } else if (count==3) {
                    cout<<"i";
                }
            } else if (s.at(j)=='5') {
                while (s.at(j)!='0') {
                    count++;
                    if (count==4) {
                        count-=3;
                    }
                    j++;
                }
                if (count==1) {
                    cout<<"j";
                } else if (count==2) {
                    cout<<"k";
                } else if (count==3) {
                    cout<<"l";
                }
            } else if (s.at(j)=='6') {
                while (s.at(j)!='0') {
                    count++;
                    if (count==4) {
                        count-=3;
                    }
                    j++;
                }
                if (count==1) {
                    cout<<"m";
                } else if (count==2) {
                    cout<<"n";
                } else if (count==3) {
                    cout<<"o";
                }
            } else if (s.at(j)=='7') {
                while (s.at(j)!='0') {
                    count++;
                    if (count==5) {
                        count-=4;
                    }
                    j++;
                }
                if (count==1) {
                    cout<<"p";
                } else if (count==2) {
                    cout<<"q";
                } else if (count==3) {
                    cout<<"r";
                } else if (count==4) {
                    cout<<"s";
                }
            } else if (s.at(j)=='8') {
                while (s.at(j)!='0') {
                    count++;
                    if (count==4) {
                        count-=3;
                    }
                    j++;
                }
                if (count==1) {
                    cout<<"t";
                } else if (count==2) {
                    cout<<"u";
                } else if (count==3) {
                    cout<<"v";
                }
            } else if (s.at(j)=='9') {
                while (s.at(j)!='0') {
                    count++;
                    if (count==5) {
                        count-=4;
                    }
                    j++;
                }
                if (count==1) {
                    cout<<"w";
                } else if (count==2) {
                    cout<<"x";
                } else if (count==3) {
                    cout<<"y";
                } else if (count==4) {
                    cout<<"z";
                }
            }
            j++;
        }
        cout<<endl;
    }
}

C++: // Author :
// Date :
// Problem:
// Solution:
// Comment:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <cmath>
#include <cstring>

#define pp push
#define pb push_back
#define mp make_pair
#define xx first
#define yy second

using namespace std;

void play(string str){
    string mas[]={"x",".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
    int lng = 0;
    
    for(int i = 0; i < str.size() ; i++){
        if(str[i] == '0'){
            if(lng!=0){
                //cout << (lng-1) << " " << mas[str[i-1]-'0'].size() << endl;
                cout << mas[str[i-1]-'0'][(lng-1)%mas[str[i-1]-'0'].size()] << endl;
                lng = 0;
            }
        }
        else lng++;
    }       
}

main(){
    //freopen("2006-input.txt","r",stdin);
    
    int t;
    string str;
    
    cin >> t;
    
    while(t--){
        cin >> str;
        
        play(str);
    }
    #ifdef GEREL
        for(;;);
    #endif

    return 0;
}