#include<iostream>
#include<cstdio>

using namespace std;

int main(){
  int n;
  int map[200];
  map['A'] = 1;
  map['2'] = 2;
  map['3'] = 3;
  map['4'] = 4;
  map['5'] = 5;
  map['6'] = 6;
  map['7'] = 7;
  map['8'] = 8;
  map['9'] = 9;
  map['T'] = 10;
  map['J'] = 10;
  map['Q'] = 10;
  map['K'] = 10;

  cin>>n;
  while( n --> 0){
    int sum = 0;
    bool ace = false;
    bool ele = false;
    bool dec = true;
    int d[8];
    for(int i=0; i<2; i++){
      char tmp; cin>>tmp;
      int c = map[tmp];
      if(c == 1) ace = true;
      sum += c;
    }
    for(int i=0; i<8; i++){
      char tmp; cin>>tmp;
      d[i] = map[tmp];
    }
    if(ace && sum + 10 <= 21){
      ele = true;
      sum += 10;
    }
    int idx = 0;
    while( sum <= 16 || (ele && sum == 17) ){
      int c = d[idx++];
      dec = false;
      if(!ace && c == 1)
        ace = true;
      sum += c;
      if(ace && !ele && sum + 10 <= 21){
        ele = true;
        sum += 10;
      }
      if(sum > 21 && ele){
        ele = false;
        sum -= 10;
      }
    }
    if(sum > 21) puts("bust");
    else if(dec && sum == 21) puts("blackjack");
    else printf("%d\n",sum);
  }
  return 0;
}