#include<bits/stdc++.h> using namespace std; int main() { int n,sum=0,v; string b; cin>>n; while(n) { cin>>b; b+='-'; for(int i=0; i<=b.size()-1; i++) { if(b[i]=='#') cout<<' '; else { if(b[i]=='-') sum=0; if(b[i]>=48&&b[i]<=57) { for(int j=i; b[j]>=48&&b[j]<=57; j++) { sum=sum*10+(b[j]-'0'); v=j; } cout<<(char)(sum+64); i=v; sum=0; } } } cout<<endl; n--; } return 0; }