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++: #define	_USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
#include <complex>
#include <utility>
#include <numeric>
#define  rep(i,n) for(int i=0;i<(n);i++)
#define  REP(i,a,n) for(int i=a;i<(n);i++)
#define  rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define  VI	vector<int>
#define	 VS vector<string>
#define  all(a) (a).begin(),(a).end()
#define  debug(x) cout<<#x<<": "<<x<<endl
using namespace std;
typedef pair<int,int> P;
typedef long long ll;

const int INF=1000000;
char fi[101][101];
int d[21][21];
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int N,M;
int sx,sy;
int gx,gy;
int w,h;
int ans;

int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
const int MAX_V=100;
const int MAX_N=100;
char o[3]={'+','-','*'};
#define md 1000003

int dp[353][353]={0};
int bow[353][353]={0};


int main(){
	
	string s;
	int n;
	while(n>0){
		cin>>s;
		vector<string> p(10);
		p[1]=".,!? ";
		p[2]="abc";
		p[3]="def";
		p[4]="ghi";
		p[5]="jkl";
		p[6]="mno";
		p[7]="pqrs";
		p[8]="tuv";
		p[9]="wxyz";
		bool f=false;
		char c='0';
		int count=0;
		string a="";
		rep(i,s.size()){
			if(s[i]=='0'){
				if(f){
				if(c=='1'){
					count=(count-1)%5;
				}
				else if(c=='7'||c=='9'){
					count=(count-1)%4;
				}
				else{
					count=(count-1)%3;
				}
				a+=p[c-'0'][count];
				f=false;
				count=0;
				c='0';
				}
			}
			else{
				f=true;
				if(c!=s[i]){
					c=s[i];
					count=1;
				}
				else
					count++;
				
			}
			
		}
		cout<<a<<endl;
		n--;
	}
	
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#include<queue>	

using namespace std;

namespace MyLib {
#define ALL(a) a.begin(),a.end()
#define REP(i,n) for(int i=0;i<n;i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define debug(x) if(1)cout<<#x<<":"<<x<<endl;
#define DEBUG(x) if(1)cout<<#x<<":"<<x<<endl;
#define ll long long
}

using namespace MyLib;


int main() {
	string r;
	int n;
	cin >> n;
	REP(x,n){
		cin >> r;
		string s = "";
		int co = 0;
		string buf = "";
		int num = 0;
		REP(i, r.size())
			if (r[i] == '0') {
				if (num == 0)
					continue;
				if (num == 1)
					if (co % 5 == 1)
						buf = ".";
					else if (co % 5 == 2)
						buf = ",";
					else if (co % 5 == 3)
						buf = "!";
					else if (co % 5 == 4)
						buf = "?";
					else
						buf = ' ';
				else if (2 <= num&& num<= 6)
					buf = 'a' + (num - 2) * 3 + (co + 2) % 3;
				else if (num == 7)
					buf = 'p' + (co + 3) % 4;
				else if (num == 8) 
					buf = 't' + (co + 2) % 3;
				else {
					buf = 'w' + (co + 3) % 4;
				}
				s = s + buf;
				co = 0;
				num = 0;

			}
			else {
				num = (r[i] - '0');
				co++;
			}
			cout << s << endl;
	}

	return 0;

}

C++: #include<iostream>

using namespace std;

string str;

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

void solve() {
    cin>>str;
    char c = '\0';
    int cnt=-1;
    int num=0;

    for(int i=0;i<str.size();i++) {
        
        if(str[i]=='0') {
            if(cnt==-1) c='\0';
            else c=keys[num-1][cnt];
            cout<<(c);
            c='\0';
            cnt=-1;
            num=0;
        }
        else {
            num=str[i]-'0';
            cnt++;
            cnt%=keys[num-1].size();            
        }
    }
    cout<<endl;
}

int main() {
    int n;
    cin>>n;
    for(int i=0;i<n;i++) {
        solve();
    }

    return 0;
}

C++: #include<bits/stdc++.h>
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

string s;

vector<vector<char> > b{
  vector<char>{},
  vector<char>{'.',',','!','?',' '},
  vector<char>{'a','b','c'},
  vector<char>{'d','e','f'},
  vector<char>{'g','h','i'},
  vector<char>{'j','k','l'},
  vector<char>{'m','n','o'},
  vector<char>{'p','q','r','s'},
  vector<char>{'t','u','v'},
  vector<char>{'w','x','y','z'},
};
int main(){ _;
  int n;cin>>n;
  REP(i,n){
    cin>>s;
    int last=0;
    int count=0;
    for(int j=0;j<(int)s.size();j++){
      if(last==0){
	count=0;
      }else if(s[j]=='0'){
	cout<<b[last][count%(int)b[last].size()];
      }else{
	count++;
      }
      last=(s[j]-'0');
    }
    cout<<endl;
  }
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

string keitai[]{".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};
int main(){
	string s;
	while(cin>>s){
		int cnt=0;
		string ans;
		rep(i,s.size()){
			if(s[i]=='0'){
				if(cnt)ans+=keitai[s[i-1]-'1'][(cnt-1)%keitai[s[i-1]-'1'].size()];
				cnt=0;
			}
			if(i&&s[i-1]!=s[i])cnt=0;
			else cnt++;
		}
		cout<<ans<<endl;
	}
}

C++: #include <iostream>
#include <cstring>
using namespace std;


int X;
char s[1050];

string b[9] = {".,!? ","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"};


int main(){

  cin >> X;
  while(X){

    cin >> s;

    int i = 0;
    char pre;
    int n;

    for(i = 0; i < strlen(s); i++){
      n = 1;
     
      pre = s[i];
      if(pre == '0') continue;
      while(pre == s[i+1] && i < strlen(s)){
	n++;
	i++;
      }
      int x = atoi(&pre);
   
      cout <<  b[x-1][(n-1) % b[x-1].length()];
    }
    cout << endl;
    X--;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		string str,one=".,!? ",ans,seven="pqrswxyz";
		cin>>str;
		for(int j=0,co=0,num=0;j<=str.size();j++){
			if(num==str[j]-'0')co++;
			else{
				if(num==1)ans+=one[co%5];
				else if(num==7||num==9)ans+=seven[co%4+num/9*4];
				else if(num==8)ans+=co%3+'t';
				else if(num>1)ans+=co%3+'a'+3*(num-2);
				co=0;
				num=str[j]-'0';
			}
		}
		cout<<ans<<endl;
	}
}

C++: #include<iostream>
#include<stdlib.h>
#include<string.h>
using namespace std;
const char button[10][6] = {	{},
								{'.',',','!','?',' '},
								{'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',}};
const int num[10] = {0,5,3,3,3,3,3,4,3,4};
int main()
{
	int n;
	cin >> n;
	char line[1024];
	for (int i = 0; i < n; i++)
	{
		cin >> line;
		int len = strlen(line);
		int j = 0;
		while (j < len)
		{
			int next = j + 1;
			int count = 0;
			while(next < len  && line[next] == line[j])
			{
				next++;
				count++;
			}
			if ((line[j] - '0') != 0)
			{
				int number = line[j] - '0';
				int length = num[number];
				cout << button[number][count % length];
			}
			count = 0;
			j = next;
		}
		cout<<endl;

	}
	return 0;
}