#include<iostream>
#include<sstream>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<algorithm>
#include<numeric>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define rp(i,c) rep(i,(c).size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double INF=1e12,EPS=1e-9;

int v[256];

int main()
{
	for(int i=2;i<=9;i++)v['0'+i]=i;
	v['A']=11; v['T']=v['J']=v['Q']=v['K']=10;
	
	int CS; cin>>CS;
	rep(cs,CS)
	{
		int ace=0,score=0,cur=2;
		char cd[10]; rep(i,10)cin>>cd[i];
		rep(i,2)if(cd[i]=='A')ace++;
		
		score=v[cd[0]]+v[cd[1]];
		if(score==21)
		{
			cout<<"blackjack"<<endl; continue;
		}
		
		while(score>21&&ace)ace--,score-=10;
		
		while(score<=16||score==17&&ace)
		{
			score+=v[cd[cur]];
			if(cd[cur]=='A')ace++; cur++;
			
			while(score>21&&ace)ace--,score-=10;
		}
		if(score>21)cout<<"bust"<<endl;
		else cout<<score<<endl;
	}
	
	return 0;
}