#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s); sin>>v; return v;}
template<class T> inline string toString(T x) {ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI = acos(-1.0);

int main() {
	int n; cin >> n;
	REP(t, n) {
		int score = 0;
		int ace = 0;
		char c[2]; cin >> c[0] >> c[1];
		REP(i, 2) {
			if ('2' <= c[i] && c[i] <= '9') {
				score += c[i] - '0';
			} else if (c[i] == 'A') {
				ace++;
				score += 11;
			} else {
				score += 10;
			}
		}
		char stack[8]; REP(_i, 8) { cin >> stack[_i]; }
		if (score == 21) { printf("blackjack\n"); continue; }
		if (score > 21) {
			if (ace) {
				ace--;
				score -= 10;
			}
		}
		int i = -1;
		while (true) {
			if (score == 17) {
				if (ace) {
					goto HIT;
				}
			}
			if (score > 21) {
				printf("bust\n");
				break;
			}
			if (score > 16) {
				printf("%d\n", score);
				break;
			}
			
HIT:
			++i; // Stack position
			if ('2' <= stack[i] && stack[i] <= '9') {
				score += stack[i] - '0';
			} else if (stack[i] == 'A') {
				ace++;
				score += 11;
				if (score > 21) {
					ace--;
					score -= 10;
				}
			} else {
				score += 10;
			}
			if (score > 21) {
				if (ace) {
					ace--;
					score -= 10;
				}
			}
		}
	}
}