#include <iostream>
using namespace std;

int p;
bool aceFlg; //ツエツーツスツつェ11ツづつオツづカツウツδ督トツつウツづェツづづゥツフツδ可グ
bool printFlg;
char card[128];

void add(char ch){
	if(ch == 'A'){
		if(p+11 <= 21){
			p += 11;
			aceFlg = true;
		}else{
			p++;
		}
	} else{
		p += card[ch];
	}
}

int main(void){
	for(int i=2;i<10;i++) card['0'+i] = i;
	card['T'] = card['J'] = card['Q'] = card['K'] = 10;

	int n;
	cin>>n;

	while(n--){
		p = aceFlg = 0;
		printFlg = true;
		char a,b;
		cin>>a>>b;

		add(a);
		add(b);
		if(p == 21){
			cout<<"blackjack\n";
			printFlg = false;
		}

		for(int i=0;i<8;i++){
			char ch;
			cin>>ch;
			if(!printFlg) continue;

			if(p <= 16 || p == 17 && aceFlg){
				add(ch);
				if(p > 21 && aceFlg){
					p -= 10;
					aceFlg = false;
				}
				if(p > 21){
					cout<<"bust\n";
					printFlg = false;
				}
			}
		}

		if(printFlg){
			cout<<p<<endl;
		}
	}

	return 0;
}