#include<bits/stdc++.h> using namespace std; int n,sl,num; string s; char change(int num){ char c='A'+num-1; return c; } int main(){ cin>>n; while(n--){ cin>>s; num=0; s+="-";// sl=s.length(); for(int i=0;i<sl;i++){ if(s[i]=='#'){ if(num!=0) cout<<change(num); cout<<' '; num=0; }else if(s[i]=='-'){ if(num!=0) cout<<change(num); num=0; }else{ if(num==0) num=s[i]-'0'; if(num>0&&num<10) num=num*10+(s[i]-'0'); } } cout<<endl; } return 0; }