#include <iostream>
#include <string>

using namespace std;

int conv(char c){
  if(c == 'A') return 11;
  if(c == 'T' || c == 'J' || c == 'Q' || c == 'K') return 10;
  return c - '0';
}

int main(){
  int n;
  cin >> n;
  while(n--){
    char c;
    int sum = 0;
    bool ace = false;
    for(int j=0;j<2;j++){
      cin >> c;
      sum += conv(c);
      if(c == 'A') ace = true;
      if(sum > 21) sum -= 10;
    }
    string str;
    for(int i=0;i<8;i++){
      cin >> c;
      str += c;
    }

    if(sum == 21){
      cout << "blackjack" << endl;
      continue;
    }

    for(int j=0;j<8;j++){
      if(sum <= 16 || (sum == 17 && ace)){
        if(conv(str[j])) sum += conv(str[j]);
        if(str[j] == 'A'){
          if(sum > 21) sum -= 10;
          else ace = true;
        }
        if(sum > 21 && ace){
          ace = 0;
          sum -= 10;
        }
      }
    }
    if(sum > 21) cout << "bust" << endl;
    else cout << sum << endl;
  }
}