### constant

C2N = {
  'A' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => 5,
  '6' => 6, '7' => 7, '8' => 8, '9' => 9, 'T' => 10,
  'J' => 10, 'Q' => 10, 'K' => 10
}

### subroutines

def score(hs)
  sum = 0
  na = 0
  ace = false
  
  for hi in hs
    sum += C2N[hi]
    na += 1 if hi == 'A'
  end

  while sum <= 11 && na > 0
    sum += 10
    na -= 1
    ace = true
  end

  [sum, ace]
end

### main

n = gets.to_i

n.times do
  hs = gets.strip.split
  pcs = gets.strip.split
  #p [hs, pcs]

  sc, ace = score(hs)
  if sc == 21
    puts 'blackjack'
    next
  end

  loop do
    sc, ace = score(hs)

    if sc <= 16 || (sc == 17 && ace)
      hs << pcs.shift
    else
      break
    end
  end

  sc, ace = score(hs)
  puts (sc > 21 ? "bust" : sc)
end