#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdlib>
#include<cstdio>
#include<cstring>
using namespace std;
int main(){
  int h,i;
  int s[256];
  for(i=2;i<=9;i++)
    s[i+'0']=i;
  s['A']=1;
  s['T']=s['J']=s['Q']=s['K']=10;
  int n;
  cin>>n;
  for(h=0;h<n;h++){
    int sm=0,ct=0,bj=0;
    for(i=0;i<2;i++){
      char t;
      cin>>t;
      sm+=s[(int)t];
      if(t=='A')
	ct=1;
    }
    if(sm==11&&ct)
      bj=1;
    for(i=0;i<8;i++){
      char t;
      cin>>t;
      if(ct){
	if(0){
	}else if(sm+10<=17){
	  sm+=s[(int)t];
	}else if(sm+10<=21){
	}else if(sm<=16){
	  sm+=s[(int)t];
	}
      }else{
	if(sm<=16){
	  sm+=s[(int)t];
	  if(t=='A')
	    ct=1;
	}
      }
    }
    if(bj){
      cout<<"blackjack"<<endl;
    }else{
      if(ct){
	if(0){
	}else if(sm>21){
	  cout<<"bust"<<endl;
	}else if(sm+10>21){
	  cout<<sm<<endl;
	}else{
	  cout<<sm+10<<endl;
	}
      }else{
	if(sm>21){
	  cout<<"bust"<<endl;
	}else{
	  cout<<sm<<endl;
	}
      }
    }
  }
  return 0;
}