The only difference between the easy and hard versions is that the given string $s$ in the easy version is initially a palindrome, this condition is not always true for the hard version.

A palindrome is a string that reads the same left to right and right to left. For example, "101101" is a palindrome, while "0101" is not.

Alice and Bob are playing a game on a string $s$ of length $n$ consisting of the characters '0' and '1'. Both players take alternate turns with Alice going first.

In each turn, the player can perform one of the following operations:

Choose any $i$ ($1 \le i \le n$), where $s[i] =$ '0' and change $s[i]$ to '1'. Pay 1 dollar.

Reverse the whole string, pay 0 dollars. This operation is only allowed if the string is currently not a palindrome, and the last operation was not reverse. That is, if Alice reverses the string, then Bob can't reverse in the next move, and vice versa.

Reversing a string means reordering its letters from the last to the first. For example, "01001" becomes "10010" after reversing.

The game ends when every character of string becomes '1'. The player who spends minimum dollars till this point wins the game and it is a draw if both spend equal dollars. If both players play optimally, output whether Alice wins, Bob wins, or if it is a draw.


-----Input-----

The first line contains a single integer $t$ ($1 \le t \le 10^3$). Then $t$ test cases follow.

The first line of each test case contains a single integer $n$ ($1 \le n \le 10^3$).

The second line of each test case contains the string $s$ of length $n$, consisting of the characters '0' and '1'. It is guaranteed that the string $s$ contains at least one '0'.

Note that there is no limit on the sum of $n$ over test cases.


-----Output-----

For each test case print a single word in a new line:

"ALICE", if Alice will win the game,

"BOB", if Bob will win the game,

"DRAW", if the game ends in a draw.


-----Examples-----

Input
3
3
110
2
00
4
1010
Output
ALICE
BOB
ALICE


-----Note-----

In the first test case of example,

in the $1$-st move, Alice will use the $2$-nd operation to reverse the string, since doing the $1$-st operation will result in her loss anyway. This also forces Bob to use the $1$-st operation.

in the $2$-nd move, Bob has to perform the $1$-st operation, since the $2$-nd operation cannot be performed twice in a row. All characters of the string are '1', game over.

Alice spends $0$ dollars while Bob spends $1$ dollar. Hence, Alice wins.

In the second test case of example,

in the $1$-st move Alice has to perform the $1$-st operation, since the string is currently a palindrome.

in the $2$-nd move Bob reverses the string.

in the $3$-rd move Alice again has to perform the $1$-st operation. All characters of the string are '1', game over.

Alice spends $2$ dollars while Bob spends $0$ dollars. Hence, Bob wins.

Source: codeforces | Difficulty: HARD
Tags: Game theory

Constructive algorithms


Solutions:
for nt in range(int(input())):
	n = int(input())
	s = input()
	if s[::-1] == s:
		if s.count('0') == 0:
			print('DRAW')
			continue
		if n % 2 and s[n // 2] == '0' and (s.count('0') != 1):
			print('ALICE')
		else:
			print('BOB')
		continue
	s = list(s)
	diff = False
	flag = False
	for i in range(n):
		if s[i] != s[n - i - 1]:
			if diff:
				flag = True
				break
			diff = True
			s[i] = '1'
			s[n - i - 1] = '1'
	if flag or s.count('0') == 0:
		print('ALICE')
		continue
	if n % 2 and s[n // 2] == '0' and (s.count('0') == 1):
		print('DRAW')
	else:
		print('ALICE')


import sys
input = sys.stdin.buffer.readline
for t in range(int(input())):
	N = int(input())
	S = list(input())
	(a, b, c) = (0, 0, 0)
	for i in range(N + 1 >> 1):
		if i == N - i - 1:
			if S[i] == 48:
				a += 1
		elif S[i] == 48 and S[N - i - 1] == 48:
			b += 1
		elif S[i] == 48 or S[N - i - 1] == 48:
			c += 1
	if a == 0:
		if b == 0 and c == 0:
			print('DRAW')
		elif b > 0 and c == 0:
			print('BOB')
		else:
			print('ALICE')
	elif b == 0 and c == 0:
		print('BOB')
	elif b == 0 and c == 1:
		print('DRAW')
	else:
		print('ALICE')


from math import ceil, floor

def solve():
	count = 0
	palin = True
	z = 0
	for i in range(n):
		if s[i] == '0':
			count += 1
		if s[i] != s[n - i - 1]:
			palin = False
	if palin:
		if count == 0:
			return 'DRAW'
		if count != 1 and count % 2 == 1:
			return 'ALICE'
		return 'BOB'
	if n % 2 and s[floor(n / 2)] == '0' and (count == 2):
		return 'DRAW'
	return 'ALICE'
T = int(input())
for t in range(1, T + 1):
	n = int(input())
	s = input()
	ans = solve()
	print(ans)


import os
import sys
from collections import Counter
from io import BytesIO, IOBase
from math import gcd, inf, sqrt, ceil

def lcm(a, b):
	return a * b // gcd(a, b)

def sieve():
	spf[1] = 1
	for i in range(2, MAXN):
		spf[i] = i
	for i in range(4, MAXN, 2):
		spf[i] = 2
	for i in range(3, ceil(sqrt(MAXN))):
		if spf[i] == i:
			for j in range(i * i, MAXN, i):
				if spf[j] == j:
					spf[j] = i

def getFactorization(x):
	ret = set()
	while x != 1:
		ret.add(spf[x])
		x = x // spf[x]
	return ret

def printDivisors(n):
	i = 2
	z = [1, n]
	while i <= sqrt(n):
		if n % i == 0:
			if n / i == i:
				z.append(i)
			else:
				z.append(i)
				z.append(n // i)
		i = i + 1
	return z

def create(n, x, f):
	pq = len(bin(n)[2:])
	if f == 0:
		tt = min
	else:
		tt = max
	dp = [[inf] * n for _ in range(pq)]
	dp[0] = x
	for i in range(1, pq):
		for j in range(n - (1 << i) + 1):
			dp[i][j] = tt(dp[i - 1][j], dp[i - 1][j + (1 << i - 1)])
	return dp

def enquiry(l, r, dp, f):
	if l > r:
		return inf if not f else -inf
	if f == 1:
		tt = max
	else:
		tt = min
	pq1 = len(bin(r - l + 1)[2:]) - 1
	return tt(dp[pq1][l], dp[pq1][r - (1 << pq1) + 1])

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	x = []
	for i in range(2, n + 1):
		if prime[i]:
			x.append(i)
	return x

def main():
	for _ in range(int(input())):
		n = int(input())
		s = input().strip()
		x = 0
		for i in range(len(s) // 2):
			if s[i] != s[n - 1 - i]:
				x += 1
		if x > 2:
			print('ALICE')
		elif x == 0:
			xx = s.count('0')
			if xx == 1:
				print('BOB')
			elif xx % 2 == 0:
				print('BOB')
			else:
				print('ALICE')
		elif x == 2:
			print('ALICE')
		elif x == 1:
			xx = s.count('0') - x
			if xx == 1:
				print('DRAW')
			else:
				print('ALICE')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
main()


for _ in range(int(input())):
	x = int(input())
	y = list(input())
	diff = 0
	for i in range(x // 2):
		if y[i] != y[x - i - 1]:
			if y[i] == '0':
				y[i] = '1'
			else:
				y[x - i - 1] = '1'
			diff += 1
	n = y.count('0')
	if diff == 0:
		if n == 0:
			print('DRAW')
		elif n % 2 == 0 or n == 1:
			print('BOB')
		else:
			print('ALICE')
	elif diff == 1 and n == 1:
		print('DRAW')
	else:
		print('ALICE')


import os
import sys
import math
from io import BytesIO, IOBase
import io
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=10 ** 6, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353

class LazySegTree:

	def __init__(self, _op, _e, _mapping, _composition, _id, v):

		def set(p, x):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			_d[p] = x
			for i in range(1, _log + 1):
				_update(p >> i)

		def get(p):
			assert 0 <= p < _n
			p += _size
			for i in range(_log, 0, -1):
				_push(p >> i)
			return _d[p]

		def prod(l, r):
			assert 0 <= l <= r <= _n
			if l == r:
				return _e
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r >> i)
			sml = _e
			smr = _e
			while l < r:
				if l & 1:
					sml = _op(sml, _d[l])
					l += 1
				if r & 1:
					r -= 1
					smr = _op(_d[r], smr)
				l >>= 1
				r >>= 1
			return _op(sml, smr)

		def apply(l, r, f):
			assert 0 <= l <= r <= _n
			if l == r:
				return
			l += _size
			r += _size
			for i in range(_log, 0, -1):
				if l >> i << i != l:
					_push(l >> i)
				if r >> i << i != r:
					_push(r - 1 >> i)
			l2 = l
			r2 = r
			while l < r:
				if l & 1:
					_all_apply(l, f)
					l += 1
				if r & 1:
					r -= 1
					_all_apply(r, f)
				l >>= 1
				r >>= 1
			l = l2
			r = r2
			for i in range(1, _log + 1):
				if l >> i << i != l:
					_update(l >> i)
				if r >> i << i != r:
					_update(r - 1 >> i)

		def _update(k):
			_d[k] = _op(_d[2 * k], _d[2 * k + 1])

		def _all_apply(k, f):
			_d[k] = _mapping(f, _d[k])
			if k < _size:
				_lz[k] = _composition(f, _lz[k])

		def _push(k):
			_all_apply(2 * k, _lz[k])
			_all_apply(2 * k + 1, _lz[k])
			_lz[k] = _id
		_n = len(v)
		_log = _n.bit_length()
		_size = 1 << _log
		_d = [_e] * (2 * _size)
		_lz = [_id] * _size
		for i in range(_n):
			_d[_size + i] = v[i]
		for i in range(_size - 1, 0, -1):
			_update(i)
		self.set = set
		self.get = get
		self.prod = prod
		self.apply = apply
MIL = 1 << 20

def makeNode(total, count):
	return total * MIL + count

def getTotal(node):
	return math.floor(node / MIL)

def getCount(node):
	return node - getTotal(node) * MIL
nodeIdentity = makeNode(0.0, 0.0)

def nodeOp(node1, node2):
	return node1 + node2
	return makeNode(getTotal(node1) + getTotal(node2), getCount(node1) + getCount(node2))
identityMapping = -1

def mapping(tag, node):
	if tag == identityMapping:
		return node
	count = getCount(node)
	return makeNode(tag * count, count)

def composition(mapping1, mapping2):
	return mapping1 if mapping1 != identityMapping else mapping2
prime = [True for i in range(10)]
pp = [0] * 10

def SieveOfEratosthenes(n=10):
	p = 2
	c = 0
	while p * p <= n:
		if prime[p] == True:
			c += 1
			for i in range(p, n + 1, p):
				pp[i] += 1
				prime[i] = False
		p += 1

def binarySearch(arr, n, key):
	left = 0
	right = n - 1
	mid = 0
	res = arr[n - 1]
	while left <= right:
		mid = (right + left) // 2
		if arr[mid] >= key:
			res = arr[mid]
			right = mid - 1
		else:
			left = mid + 1
	return res

def binarySearch1(arr, n, key):
	left = 0
	right = n - 1
	mid = 0
	res = arr[0]
	while left <= right:
		mid = (right + left) // 2
		if arr[mid] > key:
			right = mid - 1
		else:
			res = arr[mid]
			left = mid + 1
	return res

def palindrome(s):
	n = len(s)
	for i in range((n + 1) // 2):
		if s[i] != s[n - i - 1]:
			return 0
	return 1

def one(s):
	n = len(s)
	c = 0
	for i in range((n + 1) // 2):
		if s[i] != s[n - i - 1]:
			c += 1
	return c
for _ in range(int(input())):
	n = int(input())
	s = input()
	c = s.count('0')
	if n % 2 and s[n // 2] == '0':
		if c > 2:
			print('ALICE')
		elif c == 2:
			print('DRAW')
		else:
			print('BOB')
	elif palindrome(s):
		print('BOB')
	else:
		print('ALICE')


t = int(input())
for _i in range(t):
	n = int(input())
	s = input()
	if s == s[::-1]:
		if n % 2 == 1 and s[n // 2] == '0' and (s.count('0') > 1):
			print('ALICE')
		else:
			print('BOB')
	elif n % 2 == 1 and s[n // 2] == '0' and (s.count('0') == 2):
		print('DRAW')
	else:
		print('ALICE')


n = int(input())
for i in range(n):
	l = int(input())
	s = input()
	c = s.count('0')
	if s == s[::-1]:
		if c % 2 == 0 or c == 1:
			print('BOB')
		else:
			print('ALICE')
	elif l % 2 == 0:
		print('ALICE')
	elif c == 2 and s[l // 2] == '0':
		print('DRAW')
	else:
		print('ALICE')


def get_first_palindrome_score(n_0):
	return 0 if n_0 == 0 else -1 if n_0 == 1 else 1 if n_0 % 2 != 0 else -2
n = int(input())
data = list()
for i in range(n):
	m = int(input())
	a = input().strip()
	data.append((m, a))
for (m, a) in data:
	c_0 = 0
	c_diff = 0
	for i in range(int((len(a) + 1) / 2)):
		if a[i] != a[len(a) - 1 - i]:
			c_diff += 1
	for i in a:
		if i == '0':
			c_0 += 1
	if c_diff == 0:
		score = get_first_palindrome_score(c_0)
	else:
		c_02 = c_0 - c_diff
		k = get_first_palindrome_score(c_02)
		score = max(c_diff + k, c_diff - 2 - k)
	print('ALICE' if score > 0 else 'BOB' if score < 0 else 'DRAW')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input().strip()
	mismatch = 0
	empties = 0
	for (x, y) in zip(s, s[::-1]):
		mismatch += x != y
		empties += x == y == '0'
	ayaya = n % 2 == 0 or s[n // 2] == '1' or empties == 1
	if mismatch == 0:
		if n % 2 == 0 or s[n // 2] == '1' or empties == 1:
			print('BOB')
		else:
			print('ALICE')
	elif empties == 1 and mismatch == 2:
		print('DRAW')
	else:
		print('ALICE')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	k = s.count('0')
	if s == s[::-1]:
		if k == 0:
			print('DRAW')
		elif k % 2 and k != 1:
			print('ALICE')
		else:
			print('BOB')
	elif n % 2 == 0 or s[n // 2] == '1':
		print('ALICE')
	elif k == 2:
		print('DRAW')
	else:
		print('ALICE')


import sys
CONST = 100030001

def get_ints():
	return map(int, sys.stdin.readline().strip().split())
t = int(input())
while t:
	n = int(input())
	s = list(str(input()))
	count_0 = s.count('0')
	if s == s[::-1]:
		if count_0 % 2 and count_0 != 1:
			print('ALICE')
		else:
			print('BOB')
	elif count_0 == 2 and n % 2 and (s[n // 2] == '0'):
		print('DRAW')
	else:
		print('ALICE')
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	c = 0
	for i in range(len(s) // 2):
		if s[i] != s[-(i + 1)]:
			c += 1
	p = s.count('0') - c
	if p == c and (p == 1 or p == 0):
		print('DRAW')
	elif p == 0:
		print('ALICE')
	elif c == 0 and (p < 2 or p % 2 == 0):
		print('BOB')
	else:
		print('ALICE')


from itertools import combinations, permutations, combinations_with_replacement, product
from time import time
import itertools
from timeit import timeit
import timeit
import time
from random import *
import random
import collections
import bisect
import os
import math
from collections import defaultdict, OrderedDict, Counter
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
from queue import Queue, PriorityQueue
from heapq import *
from statistics import *
from math import sqrt, log10, log2, log, gcd, ceil, floor
import fractions
import copy
from copy import deepcopy
import sys
import io
sys.setrecursionlimit(10000)
mod = int(pow(10, 9)) + 7

def ncr(n, r, p=mod):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def normalncr(n, r):
	r = min(r, n - r)
	count = 1
	for i in range(n - r, n + 1):
		count *= i
	for i in range(1, r + 1):
		count //= i
	return count
inf = float('inf')
adj = defaultdict(set)
visited = defaultdict(int)

def addedge(a, b):
	adj[a].add(b)
	adj[b].add(a)

def bfs(v):
	q = Queue()
	q.put(v)
	visited[v] = 1
	while q.qsize() > 0:
		s = q.get_nowait()
		print(s)
		for i in adj[s]:
			if visited[i] == 0:
				q.put(i)
				visited[i] = 1

def dfs(v, visited):
	if visited[v] == 1:
		return
	visited[v] = 1
	print(v)
	for i in adj[v]:
		dfs(i, visited)

def reverse_bisect_right(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x > a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def reverse_bisect_left(a, x, lo=0, hi=None):
	if lo < 0:
		raise ValueError('lo must be non-negative')
	if hi is None:
		hi = len(a)
	while lo < hi:
		mid = (lo + hi) // 2
		if x >= a[mid]:
			hi = mid
		else:
			lo = mid + 1
	return lo

def get_list():
	return list(map(int, input().split()))

def make_list(m):
	m += list(map(int, input().split()))

def get_str_list_in_int():
	return [int(i) for i in list(input())]

def get_str_list():
	return list(input())

def get_map():
	return map(int, input().split())

def input_int():
	return int(input())

def matrix(a, b):
	return [[0 for i in range(b)] for j in range(a)]

def swap(a, b):
	return (b, a)

def find_gcd(l):
	a = l[0]
	for i in range(len(l)):
		a = gcd(a, l[i])
	return a

def is_prime(n):
	sqrta = int(sqrt(n))
	for i in range(2, sqrta + 1):
		if n % i == 0:
			return 0
	return 1

def prime_factors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n //= 2
	sqrta = int(sqrt(n))
	for i in range(3, sqrta + 1, 2):
		while n % i == 0:
			n //= i
			l.append(i)
	if n > 2:
		l.append(n)
	return l

def p(a):
	if type(a) == str:
		print(a + '\n')
	else:
		print(str(a) + '\n')

def ps(a):
	if type(a) == str:
		print(a)
	else:
		print(str(a))

def kth_no_not_div_by_n(n, k):
	return k + (k - 1) // (n - 1)

def forward_array(l):
	n = len(l)
	stack = []
	forward = [0] * n
	for i in range(len(l) - 1, -1, -1):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			forward[i] = len(l)
		else:
			forward[i] = stack[-1]
		stack.append(i)
	return forward

def forward_array_notequal(l):
	n = len(l)
	stack = []
	forward = [n] * n
	for i in range(len(l) - 1, -1, -1):
		while len(stack) and l[stack[-1]] <= l[i]:
			stack.pop()
		if len(stack) == 0:
			forward[i] = len(l)
		else:
			forward[i] = stack[-1]
		stack.append(i)
	return forward

def backward_array(l):
	n = len(l)
	stack = []
	backward = [0] * n
	for i in range(len(l)):
		while len(stack) and l[stack[-1]] < l[i]:
			stack.pop()
		if len(stack) == 0:
			backward[i] = -1
		else:
			backward[i] = stack[-1]
		stack.append(i)
	return backward

def char(a):
	return chr(a + 97)

def get_length(a):
	return 1 + int(log10(a))

def issq(n):
	sqrta = int(n ** 0.5)
	return sqrta ** 2 == n

def ceil(a, b):
	return int((a + b - 1) / b)

def equal_sum_partition(arr, n):
	sum = 0
	for i in range(n):
		sum += arr[i]
	if sum % 2 != 0:
		return False
	part = [[True for i in range(n + 1)] for j in range(sum // 2 + 1)]
	for i in range(0, n + 1):
		part[0][i] = True
	for i in range(1, sum // 2 + 1):
		part[i][0] = False
	for i in range(1, sum // 2 + 1):
		for j in range(1, n + 1):
			part[i][j] = part[i][j - 1]
			if i >= arr[j - 1]:
				part[i][j] = part[i][j] or part[i - arr[j - 1]][j - 1]
	return part[sum // 2][n]

def bin_sum_array(arr, n):
	for i in range(n):
		if arr[i] % 2 == 1:
			return i + 1
	binarray = [list(reversed(bin(i)[2:])) for i in arr]
	new_array = [0 for i in range(32)]
	for i in binarray:
		for j in range(len(i)):
			if i[j] == '1':
				new_array[j] += 1
	return new_array

def ispalindrome(s):
	return s == s[::-1]

def get_prefix(l):
	if l == []:
		return []
	prefix = [l[0]]
	for i in range(1, len(l)):
		prefix.append(prefix[-1] + l[i])
	return prefix

def get_suffix(l):
	if l == []:
		return []
	suffix = [l[-1]] * len(l)
	for i in range(len(l) - 2, -1, -1):
		suffix[i] = suffix[i + 1] + l[i]
	return suffix
nc = 'NO'
yc = 'YES'
ns = 'No'
ys = 'Yes'

def yesno(a):
	print(yc if a else nc)

def reduce(dict, a):
	dict[a] -= 1
	if dict[a] == 0:
		dict.pop(a)
input = stdin.readline
t = 1
t = int(input())
for i in range(t):
	n = int(input())
	s = list(input())
	counta = 0
	iter1 = 0
	iter2 = n - 1
	bob = 'BOB'
	alice = 'ALICE'
	draw = 'DRAW'
	while iter1 < iter2:
		if s[iter1] != s[iter2]:
			counta += 1
			s[iter1] = '1'
			s[iter2] = '1'
		iter1 += 1
		iter2 -= 1
	if counta > 0:
		if n % 2 == 0:
			print(alice)
			continue
		zero_count = s.count('0')
		if zero_count % 2 == 0:
			print(alice)
			continue
		elif counta == 1 and zero_count == 1:
			print(draw)
		else:
			print(alice)
	elif n % 2 == 0:
		print(bob)
	else:
		mid = n // 2
		zero_count = s.count('0')
		if s[mid] == '0':
			if zero_count == 1:
				print(bob)
			else:
				print(alice)
		else:
			print(bob)


def func1(s, n):
	k = 0
	counter_0 = 0
	for i in range(int(n / 2)):
		left = s[i]
		right = s[n - i - 1]
		if left != right:
			k += 1
		if right == '0':
			counter_0 += 1
		if left == '0':
			counter_0 += 1
	if n % 2 == 1:
		if s[int(n / 2)] == '0':
			counter_0 += 1
	if k == 0:
		if counter_0 % 2 == 1 and counter_0 != 1:
			print('ALICE')
		else:
			print('BOB')
	elif counter_0 == 2 and k == 1:
		print('DRAW')
	else:
		print('ALICE')

def main():
	t = int(input())
	for i in range(t):
		n = int(input())
		s = input()
		func1(s, n)
main()


t = int(input())
while t:
	n = int(input())
	s = input()
	n = len(s)
	cnt1 = cnt2 = 0
	mid = int((n - 1) / 2)
	for i in range(0, int(n / 2)):
		if s[i] != s[n - 1 - i]:
			cnt1 += 1
		elif s[i] == '0' and s[n - 1 - i] == '0':
			cnt2 += 1
	if n % 2 == 0 or (n % 2 != 0 and s[mid] == '1'):
		if cnt1 == 0:
			if cnt2 == 0:
				print('DRAW')
			else:
				print('BOB')
		else:
			print('ALICE')
	elif n % 2 != 0 and s[mid] == '0':
		if cnt1 == 0:
			if cnt2 == 0:
				print('BOB')
			else:
				print('ALICE')
		elif cnt2 == 0:
			if cnt1 == 1:
				print('DRAW')
			else:
				print('ALICE')
		else:
			print('ALICE')
	t -= 1


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	S = list(input())[:-1]
	zero = S.count('0')
	one = n - zero
	diff = 0
	for i in range(n):
		diff += S[i] != S[-1 - i]
	if diff == 0:
		if zero == 1:
			print('BOB')
			continue
		if zero % 2 == 0:
			print('BOB')
			continue
		else:
			print('ALICE')
			continue
	if diff == 2:
		if zero == 1:
			print('ALICE')
			continue
		if zero == 2:
			print('DRAW')
			continue
		if zero % 2 == 0:
			print('ALICE')
			continue
		else:
			print('ALICE')
			continue
	if diff > 2:
		print('ALICE')
		continue


def get_winner_easy(arr, n):
	zeros = 0
	for x in arr:
		if x == 0:
			zeros += 1
	if zeros == 1 or zeros % 2 == 0:
		return 'BOB'
	else:
		return 'ALICE'

def get_Winner_hard(arr, n):
	if arr == arr[::-1]:
		ans = get_winner_easy(arr, n)
		return ans
	else:
		zeros = 0
		for x in arr:
			if x == 0:
				zeros += 1
		if zeros == 2 and arr[n // 2] == 0 and (n % 2 != 0):
			return 'DRAW'
		else:
			return 'ALICE'
t = int(input())
while t:
	x = int(input())
	s = input()
	arr = [int(char) for char in s]
	print(get_Winner_hard(arr, x))
	t -= 1


import sys, getpass
import math, random
import functools, itertools, collections, heapq, bisect
from collections import Counter, defaultdict, deque
input = sys.stdin.readline
M9 = 10 ** 9 + 7
MAXINT = sys.maxsize
OFFLINE_TEST = getpass.getuser() == 'hkmac'

def log(*args):
	if OFFLINE_TEST:
		print('\x1b[36m', *args, '\x1b[0m', file=sys.stderr)

def solve(*args):
	if OFFLINE_TEST:
		log('----- solving ------')
		log(*args)
		log('----- ------- ------')
	return solve_(*args)

def read_matrix(rows):
	return [list(map(int, input().split())) for _ in range(rows)]

def read_strings(rows):
	return [input().strip() for _ in range(rows)]

def solve_():
	n = int(input())
	a = list(map(int, list(input())[:-1]))
	c = n - sum(a)
	if a == a[::-1]:
		if c == 1:
			print('BOB')
		elif c % 2 == 0:
			print('BOB')
		else:
			print('ALICE')
	elif n % 2 == 0 or a[n // 2] == 1:
		print('ALICE')
	elif sum(a) == n - 2:
		print('DRAW')
	else:
		print('ALICE')
for case_num in range(int(input())):
	solve()


for _ in range(int(input())):
	n = int(input())
	s = input()
	z = s.count('0')
	if s == s[::-1]:
		if z % 2 == 0:
			print('BOB')
		elif z == 1:
			print('BOB')
		else:
			print('ALICE')
	elif z == 2 and n % 2 == 1 and (s[n // 2] == '0'):
		print('DRAW')
	else:
		print('ALICE')


PI = 3.141592653589793
INF = 999999999
MOD = 1000000007

def add(x, y):
	return (x + y) % MOD

def sub(x, y):
	return (x - y + MOD) % MOD

def mul(x, y):
	return x * y % MOD

def gcd(x, y):
	if y == 0:
		return x
	return gcd(y, x % y)

def lcm(x, y):
	return x * y // gcd(x, y)

def power(x, y):
	res = 1
	x %= MOD
	while y != 0:
		if y & 1:
			res = mul(res, x)
		y >>= 1
		x = mul(x, x)
	return res

def mod_inv(n):
	return power(n, MOD - 2)

def prob(p, q):
	return mul(p, power(q, MOD - 2))

def ii():
	return int(input())

def li():
	return [int(i) for i in input().split()]

def ls():
	return [i for i in input().split()]
for t in range(ii()):
	t += 1
	n = ii()
	s = input()
	pal = 1
	um = 0
	for i in range(n):
		if s[i] != s[n - i - 1]:
			pal = 0
			um += 1
	if pal == 1:
		zeros = s.count('0')
		if n % 2 == 0:
			print('BOB')
		elif s[n // 2] == '0':
			zeros -= 1
			if zeros == 0:
				print('BOB')
			else:
				print('ALICE')
		else:
			print('BOB')
	elif n % 2 == 0:
		print('ALICE')
	elif s[n // 2] == '0':
		um //= 2
		matched = s.count('0') - um
		if um == 1 and matched == 1:
			print('DRAW')
		else:
			print('ALICE')
	else:
		print('ALICE')


import math
for _ in range(int(input())):
	n = int(input())
	string = input()
	if string == string[::-1]:
		count_zero = string.count('0')
		alice = 0
		bob = 0
		if count_zero == 1:
			print('BOB')
			continue
		if count_zero % 2 != 0:
			print('ALICE')
		else:
			print('BOB')
	else:
		palinZero = 0
		nonPalinZero = 0
		for i in range(len(string)):
			if string[i] == '0':
				if string[n - 1 - i] == '0':
					palinZero += 1
				else:
					nonPalinZero += 1
		if nonPalinZero == 1 and string[n // 2] == '0' and (palinZero + nonPalinZero == 2):
			print('DRAW')
		else:
			print('ALICE')


def palin(s):
	for i in range((len(s) + 1) // 2):
		if s[i] != s[len(s) - i - 1]:
			return False
	return True
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	a = s.count('0')
	if palin(s):
		if a % 2 == 0:
			print('BOB')
		elif a == 1:
			print('BOB')
		else:
			print('ALICE')
	elif a == 2 and len(s) % 2 == 1 and (s[len(s) // 2] == '0'):
		print('DRAW')
	else:
		print('ALICE')


for _ in range(int(input())):
	n = int(input())
	s = input()
	num = s.count('0')
	cnt = 0
	n0 = 0
	for i in range(0, n // 2):
		if s[i] != s[n - 1 - i]:
			cnt += 1
	for i in s:
		if i == '0':
			n0 += 1
	if cnt >= 2:
		print('ALICE')
	elif cnt == 0:
		if n0 == 1:
			print('BOB')
		elif n0 % 2 == 1:
			print('ALICE')
		else:
			print('BOB')
	elif n0 == 2:
		print('DRAW')
	else:
		print('ALICE')


def getResult(n, s):
	count = 0
	for c in s:
		if c == '0':
			count += 1
	v = check(s)
	if v == 0:
		if count % 2 == 0 or count == 1:
			return 'BOB'
		else:
			return 'ALICE'
	elif v == 1:
		count -= 1
		if count == 0:
			return 'ALICE'
		elif count == 1:
			return 'DRAW'
		elif count % 2 == 0:
			return 'ALICE'
		else:
			return 'ALICE'
	else:
		return 'ALICE'

def check(s):
	l = len(s)
	v = 0
	for i in range(l // 2):
		if s[i] != s[l - i - 1]:
			v += 1
	return v
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	print(getResult(n, s))


import sys
from collections import defaultdict

def pal(d):
	pr = 0
	for j in range(n // 2):
		if d[j] != d[n - j - 1]:
			pr = 1
			break
	if pr == 0:
		return True
	else:
		return False

def r1(o):
	if o % 2 != 0 and o > 1:
		print('ALICE')
	else:
		print('BOB')
input = sys.stdin.readline
t = int(input())
for i in range(t):
	n = int(input())
	d = list(input())
	o = d.count('0')
	e = d.count('1')
	if pal(d):
		r1(o)
	elif n % 2 != 0 and o == 2 and (d[n // 2] == '0'):
		print('DRAW')
	else:
		print('ALICE')


def divisors(M):
	d = []
	i = 1
	while M >= i ** 2:
		if M % i == 0:
			d.append(i)
			if i ** 2 != M:
				d.append(M // i)
		i = i + 1
	return d

def popcount(x):
	x = x - (x >> 1 & 1431655765)
	x = (x & 858993459) + (x >> 2 & 858993459)
	x = x + (x >> 4) & 252645135
	x = x + (x >> 8)
	x = x + (x >> 16)
	return x & 127

def eratosthenes(n):
	res = [0 for i in range(n + 1)]
	prime = set([])
	for i in range(2, n + 1):
		if not res[i]:
			prime.add(i)
			for j in range(1, n // i + 1):
				res[i * j] = 1
	return prime

def factorization(n):
	res = []
	for p in prime:
		if n % p == 0:
			while n % p == 0:
				n //= p
			res.append(p)
	if n != 1:
		res.append(n)
	return res

def euler_phi(n):
	res = n
	for x in range(2, n + 1):
		if x ** 2 > n:
			break
		if n % x == 0:
			res = res // x * (x - 1)
			while n % x == 0:
				n //= x
	if n != 1:
		res = res // n * (n - 1)
	return res

def ind(b, n):
	res = 0
	while n % b == 0:
		res += 1
		n //= b
	return res

def isPrimeMR(n):
	d = n - 1
	d = d // (d & -d)
	L = [2, 3, 5, 7, 11, 13, 17]
	for a in L:
		t = d
		y = pow(a, t, n)
		if y == 1:
			continue
		while y != n - 1:
			y = y * y % n
			if y == 1 or t == n - 1:
				return 0
			t <<= 1
	return 1

def findFactorRho(n):
	from math import gcd
	m = 1 << n.bit_length() // 8
	for c in range(1, 99):
		f = lambda x: (x * x + c) % n
		(y, r, q, g) = (2, 1, 1, 1)
		while g == 1:
			x = y
			for i in range(r):
				y = f(y)
			k = 0
			while k < r and g == 1:
				ys = y
				for i in range(min(m, r - k)):
					y = f(y)
					q = q * abs(x - y) % n
				g = gcd(q, n)
				k += m
			r <<= 1
		if g == n:
			g = 1
			while g == 1:
				ys = f(ys)
				g = gcd(abs(x - ys), n)
		if g < n:
			if isPrimeMR(g):
				return g
			elif isPrimeMR(n // g):
				return n // g
			return findFactorRho(g)

def primeFactor(n):
	i = 2
	ret = {}
	rhoFlg = 0
	while i * i <= n:
		k = 0
		while n % i == 0:
			n //= i
			k += 1
		if k:
			ret[i] = k
		i += 1 + i % 2
		if i == 101 and n >= 2 ** 20:
			while n > 1:
				if isPrimeMR(n):
					(ret[n], n) = (1, 1)
				else:
					rhoFlg = 1
					j = findFactorRho(n)
					k = 0
					while n % j == 0:
						n //= j
						k += 1
					ret[j] = k
	if n > 1:
		ret[n] = 1
	if rhoFlg:
		ret = {x: ret[x] for x in sorted(ret)}
	return ret

def divisors(n):
	res = [1]
	prime = primeFactor(n)
	for p in prime:
		newres = []
		for d in res:
			for j in range(prime[p] + 1):
				newres.append(d * p ** j)
		res = newres
	res.sort()
	return res

def xorfactorial(num):
	if num == 0:
		return 0
	elif num == 1:
		return 1
	elif num == 2:
		return 3
	elif num == 3:
		return 0
	else:
		x = baseorder(num)
		return 2 ** x * ((num - 2 ** x + 1) % 2) + function(num - 2 ** x)

def xorconv(n, X, Y):
	if n == 0:
		res = [X[0] * Y[0] % mod]
		return res
	x = [X[i] + X[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	y = [Y[i] + Y[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	z = [X[i] - X[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	w = [Y[i] - Y[i + 2 ** (n - 1)] for i in range(2 ** (n - 1))]
	res1 = xorconv(n - 1, x, y)
	res2 = xorconv(n - 1, z, w)
	former = [(res1[i] + res2[i]) * inv for i in range(2 ** (n - 1))]
	latter = [(res1[i] - res2[i]) * inv for i in range(2 ** (n - 1))]
	former = list(map(lambda x: x % mod, former))
	latter = list(map(lambda x: x % mod, latter))
	return former + latter

def merge_sort(A, B):
	(pos_A, pos_B) = (0, 0)
	(n, m) = (len(A), len(B))
	res = []
	while pos_A < n and pos_B < m:
		(a, b) = (A[pos_A], B[pos_B])
		if a < b:
			res.append(a)
			pos_A += 1
		else:
			res.append(b)
			pos_B += 1
	res += A[pos_A:]
	res += B[pos_B:]
	return res

class UnionFindVerSize:

	def __init__(self, N):
		self._parent = [n for n in range(0, N)]
		self._size = [1] * N
		self.group = N

	def find_root(self, x):
		if self._parent[x] == x:
			return x
		self._parent[x] = self.find_root(self._parent[x])
		stack = [x]
		while self._parent[stack[-1]] != stack[-1]:
			stack.append(self._parent[stack[-1]])
		for v in stack:
			self._parent[v] = stack[-1]
		return self._parent[x]

	def unite(self, x, y):
		gx = self.find_root(x)
		gy = self.find_root(y)
		if gx == gy:
			return
		self.group -= 1
		if self._size[gx] < self._size[gy]:
			self._parent[gx] = gy
			self._size[gy] += self._size[gx]
		else:
			self._parent[gy] = gx
			self._size[gx] += self._size[gy]

	def get_size(self, x):
		return self._size[self.find_root(x)]

	def is_same_group(self, x, y):
		return self.find_root(x) == self.find_root(y)

class WeightedUnionFind:

	def __init__(self, N):
		self.parent = [i for i in range(N)]
		self.size = [1 for i in range(N)]
		self.val = [0 for i in range(N)]
		self.flag = True
		self.edge = [[] for i in range(N)]

	def dfs(self, v, pv):
		stack = [(v, pv)]
		new_parent = self.parent[pv]
		while stack:
			(v, pv) = stack.pop()
			self.parent[v] = new_parent
			for (nv, w) in self.edge[v]:
				if nv != pv:
					self.val[nv] = self.val[v] + w
					stack.append((nv, v))

	def unite(self, x, y, w):
		if not self.flag:
			return
		if self.parent[x] == self.parent[y]:
			self.flag = self.val[x] - self.val[y] == w
			return
		if self.size[self.parent[x]] > self.size[self.parent[y]]:
			self.edge[x].append((y, -w))
			self.edge[y].append((x, w))
			self.size[x] += self.size[y]
			self.val[y] = self.val[x] - w
			self.dfs(y, x)
		else:
			self.edge[x].append((y, -w))
			self.edge[y].append((x, w))
			self.size[y] += self.size[x]
			self.val[x] = self.val[y] + w
			self.dfs(x, y)

class Dijkstra:

	class Edge:

		def __init__(self, _to, _cost):
			self.to = _to
			self.cost = _cost

	def __init__(self, V):
		self.G = [[] for i in range(V)]
		self._E = 0
		self._V = V

	@property
	def E(self):
		return self._E

	@property
	def V(self):
		return self._V

	def add_edge(self, _from, _to, _cost):
		self.G[_from].append(self.Edge(_to, _cost))
		self._E += 1

	def shortest_path(self, s):
		import heapq
		que = []
		d = [10 ** 15] * self.V
		d[s] = 0
		heapq.heappush(que, (0, s))
		while len(que) != 0:
			(cost, v) = heapq.heappop(que)
			if d[v] < cost:
				continue
			for i in range(len(self.G[v])):
				e = self.G[v][i]
				if d[e.to] > d[v] + e.cost:
					d[e.to] = d[v] + e.cost
					heapq.heappush(que, (d[e.to], e.to))
		return d

def Z_algorithm(s):
	N = len(s)
	Z_alg = [0] * N
	Z_alg[0] = N
	i = 1
	j = 0
	while i < N:
		while i + j < N and s[j] == s[i + j]:
			j += 1
		Z_alg[i] = j
		if j == 0:
			i += 1
			continue
		k = 1
		while i + k < N and k + Z_alg[k] < j:
			Z_alg[i + k] = Z_alg[k]
			k += 1
		i += k
		j -= k
	return Z_alg

class BIT:

	def __init__(self, n, mod=0):
		self.BIT = [0] * (n + 1)
		self.num = n
		self.mod = mod

	def query(self, idx):
		res_sum = 0
		mod = self.mod
		while idx > 0:
			res_sum += self.BIT[idx]
			if mod:
				res_sum %= mod
			idx -= idx & -idx
		return res_sum

	def update(self, idx, x):
		mod = self.mod
		while idx <= self.num:
			self.BIT[idx] += x
			if mod:
				self.BIT[idx] %= mod
			idx += idx & -idx
		return

class dancinglink:

	def __init__(self, n, debug=False):
		self.n = n
		self.debug = debug
		self._left = [i - 1 for i in range(n)]
		self._right = [i + 1 for i in range(n)]
		self.exist = [True for i in range(n)]

	def pop(self, k):
		if self.debug:
			assert self.exist[k]
		L = self._left[k]
		R = self._right[k]
		if L != -1:
			if R != self.n:
				(self._right[L], self._left[R]) = (R, L)
			else:
				self._right[L] = self.n
		elif R != self.n:
			self._left[R] = -1
		self.exist[k] = False

	def left(self, idx, k=1):
		if self.debug:
			assert self.exist[idx]
		res = idx
		while k:
			res = self._left[res]
			if res == -1:
				break
			k -= 1
		return res

	def right(self, idx, k=1):
		if self.debug:
			assert self.exist[idx]
		res = idx
		while k:
			res = self._right[res]
			if res == self.n:
				break
			k -= 1
		return res

class SparseTable:

	def __init__(self, A, merge_func, ide_ele):
		N = len(A)
		n = N.bit_length()
		self.table = [[ide_ele for i in range(n)] for i in range(N)]
		self.merge_func = merge_func
		for i in range(N):
			self.table[i][0] = A[i]
		for j in range(1, n):
			for i in range(0, N - 2 ** j + 1):
				f = self.table[i][j - 1]
				s = self.table[i + 2 ** (j - 1)][j - 1]
				self.table[i][j] = self.merge_func(f, s)

	def query(self, s, t):
		b = t - s + 1
		m = b.bit_length() - 1
		return self.merge_func(self.table[s][m], self.table[t - 2 ** m + 1][m])

class BinaryTrie:

	class node:

		def __init__(self, val):
			self.left = None
			self.right = None
			self.max = val

	def __init__(self):
		self.root = self.node(-10 ** 15)

	def append(self, key, val):
		pos = self.root
		for i in range(29, -1, -1):
			pos.max = max(pos.max, val)
			if key >> i & 1:
				if pos.right is None:
					pos.right = self.node(val)
					pos = pos.right
				else:
					pos = pos.right
			elif pos.left is None:
				pos.left = self.node(val)
				pos = pos.left
			else:
				pos = pos.left
		pos.max = max(pos.max, val)

	def search(self, M, xor):
		res = -10 ** 15
		pos = self.root
		for i in range(29, -1, -1):
			if pos is None:
				break
			if M >> i & 1:
				if xor >> i & 1:
					if pos.right:
						res = max(res, pos.right.max)
					pos = pos.left
				else:
					if pos.left:
						res = max(res, pos.left.max)
					pos = pos.right
			elif xor >> i & 1:
				pos = pos.right
			else:
				pos = pos.left
		if pos:
			res = max(res, pos.max)
		return res

def solveequation(edge, ans, n, m):
	x = [0] * m
	used = [False] * n
	for v in range(n):
		if used[v]:
			continue
		y = dfs(v)
		if y != 0:
			return False
	return x

	def dfs(v):
		used[v] = True
		r = ans[v]
		for (to, dire, id) in edge[v]:
			if used[to]:
				continue
			y = dfs(to)
			if dire == -1:
				x[id] = y
			else:
				x[id] = -y
			r += y
		return r

class SegmentTree:

	def __init__(self, init_val, segfunc, ide_ele):
		n = len(init_val)
		self.segfunc = segfunc
		self.ide_ele = ide_ele
		self.num = 1 << (n - 1).bit_length()
		self.tree = [ide_ele] * 2 * self.num
		self.size = n
		for i in range(n):
			self.tree[self.num + i] = init_val[i]
		for i in range(self.num - 1, 0, -1):
			self.tree[i] = self.segfunc(self.tree[2 * i], self.tree[2 * i + 1])

	def update(self, k, x):
		k += self.num
		self.tree[k] = x
		while k > 1:
			self.tree[k >> 1] = self.segfunc(self.tree[k], self.tree[k ^ 1])
			k >>= 1

	def query(self, l, r):
		if r == self.size:
			r = self.num
		res = self.ide_ele
		l += self.num
		r += self.num
		while l < r:
			if l & 1:
				res = self.segfunc(res, self.tree[l])
				l += 1
			if r & 1:
				res = self.segfunc(res, self.tree[r - 1])
			l >>= 1
			r >>= 1
		return res

	def bisect_l(self, l, r, x):
		l += self.num
		r += self.num
		Lmin = -1
		Rmin = -1
		while l < r:
			if l & 1:
				if self.tree[l] <= x and Lmin == -1:
					Lmin = l
				l += 1
			if r & 1:
				if self.tree[r - 1] <= x:
					Rmin = r - 1
			l >>= 1
			r >>= 1
		if Lmin != -1:
			pos = Lmin
			while pos < self.num:
				if self.tree[2 * pos] <= x:
					pos = 2 * pos
				else:
					pos = 2 * pos + 1
			return pos - self.num
		elif Rmin != -1:
			pos = Rmin
			while pos < self.num:
				if self.tree[2 * pos] <= x:
					pos = 2 * pos
				else:
					pos = 2 * pos + 1
			return pos - self.num
		else:
			return -1
import sys, random, bisect
from collections import deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import permutations
from math import gcd, log
input = lambda : sys.stdin.readline().rstrip()
mi = lambda : map(int, input().split())
li = lambda : list(mi())
for _ in range(int(input())):
	n = int(input())
	s = input()
	if n % 2 == 0:
		(a, b) = (0, 0)
		for i in range(n // 2):
			if s[i] == '0' and s[-i - 1] == '0':
				a += 1
			elif (s[i], s[-i - 1]) != ('1', '1'):
				b += 1
		if a != 0:
			if b != 0:
				print('ALICE')
			else:
				print('BOB')
		else:
			print('ALICE')
	elif s[n // 2] == '1':
		(a, b) = (0, 0)
		for i in range(n // 2):
			if s[i] == '0' and s[-i - 1] == '0':
				a += 1
			elif (s[i], s[-i - 1]) != ('1', '1'):
				b += 1
		if a != 0:
			if b != 0:
				print('ALICE')
			else:
				print('BOB')
		else:
			print('ALICE')
	else:
		(a, b) = (0, 0)
		for i in range(n // 2):
			if s[i] == '0' and s[-i - 1] == '0':
				a += 1
			elif (s[i], s[-i - 1]) != ('1', '1'):
				b += 1
		if a == 0:
			if b == 0:
				print('BOB')
			elif b == 1:
				print('DRAW')
			else:
				print('ALICE')
		else:
			print('ALICE')


import os
import sys
from io import BufferedIOBase, BytesIO, IOBase

def ispal(arr, n):
	l = 0
	r = n - 1
	count = 0
	while l < r:
		if arr[l] == arr[r]:
			pass
		else:
			arr[l] = 1
			arr[r] = 1
			count += 1
		l += 1
		r -= 1
	return count

def main():
	for _ in range(int(input())):
		n = int(input())
		arr = list(map(int, input()))
		count = ispal(arr, n)
		if count:
			bob = count
			zeroes = arr.count(0)
			if n % 2 and arr[n // 2] == 0:
				if bob == 1 and zeroes == 1:
					print('DRAW')
				else:
					print('ALICE')
			else:
				print('ALICE')
		else:
			zeroes = arr.count(0)
			if n % 2 and arr[n // 2] == 0:
				zeroes -= 1
				if zeroes:
					print('ALICE')
				else:
					print('BOB')
			else:
				print('BOB')

def nouse0():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse1():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse2():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def nouse3():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse4():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')

def nouse5():
	a = 420
	b = 420
	print(f'i am nitish{(a + b) // 2}')
main()


import math
import sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input().strip()
	return list(s[:len(s)])

def invr():
	return map(int, input().split())

def is_palindrome(l):
	cnt = 0
	for i in range(len(l) // 2):
		if l[i] != l[-1 - i]:
			cnt += 1
	return cnt
for _ in range(inp()):
	n = inp()
	s = insr()
	if is_palindrome(s) == 0:
		if n % 2 == 0:
			print('BOB')
		elif s[n // 2] == '0':
			v = s.count('0')
			if v > 1:
				print('ALICE')
			else:
				print('BOB')
		else:
			print('BOB')
	else:
		v = is_palindrome(s)
		val = s.count('0')
		if n % 2 == 1 and val == 2 and (v == 1):
			print('DRAW')
		else:
			print('ALICE')


import sys
for _ in range(int(input())):
	n = int(input())
	s = input()
	p = 0
	for i in range(n // 2):
		if s[i] != s[-i - 1]:
			p += 1
	if p == 0:
		o = s.count('0')
		if o % 2:
			if o == 1:
				print('BOB')
			else:
				print('ALICE')
		elif o // 2 % 2 == 0:
			print('BOB')
		else:
			print('BOB')
	else:
		o = s.count('0')
		if o == 2 and n % 2 and (s[n // 2] == '0'):
			print('DRAW')
		else:
			print('ALICE')


from sys import maxsize, stdout, stdin, stderr
mod = int(1000000000.0 + 7)

def I():
	return int(stdin.readline())

def lint():
	return [int(x) for x in stdin.readline().split()]

def S():
	return input().strip()

def grid(r, c):
	return [lint() for i in range(r)]
from collections import defaultdict, Counter
import math
import bisect
from itertools import groupby

def gcd(a, b):
	while b:
		a %= b
		tmp = a
		a = b
		b = tmp
	return a

def lcm(a, b):
	return a / gcd(a, b) * b

def check_prime(n):
	for i in range(2, int(n ** (1 / 2)) + 1):
		if not n % i:
			return False
	return True

def Bs(a, x):
	i = 0
	j = 0
	left = 0
	right = len(a)
	flag = False
	while left < right:
		mi = (left + right) // 2
		if a[mi] <= x:
			left = mi + 1
			i += 1
		else:
			right = mi
			j += 1
	if left > 0 and a[left - 1] == x:
		return (i - 1, j)
	else:
		return (-1, -1)
t = I()
for _ in range(t):
	n = I()
	s = list(map(int, input().strip()))
	if s == s[::-1]:
		if sum(s) == len(s):
			print('DRAW')
		elif n % 2 != 0 and sum(s) % 2 == 0:
			tmp = (len(s) - sum(s) - 1) // 2
			if tmp == 0:
				print('BOB')
			else:
				print('ALICE')
		else:
			print('BOB')
	elif n % 2 != 0 and s[n // 2] == 0:
		if sum(s) == len(s) - 1:
			print('BOB')
		if sum(s) == len(s) - 2:
			print('DRAW')
		else:
			print('ALICE')
	else:
		print('ALICE')


import math as m

def all_input():
	import sys
	sys.stdin = open('inputf.in', 'r')
	sys.stdout = open('outputf.in', 'w')

def another():
	print('Case #', end='')
	print(i, ':', sep='', end=' ')

def solve():
	n = int(input())
	s = input()
	alag = 0
	s1 = [char for char in s]
	for i in range(n // 2):
		if s[i] != s[n - 1 - i]:
			alag += 1
			if s[i] is '0':
				s1[i] = '1'
				s1[n - 1 - i] = '1'
			else:
				s1[i] = '1'
				s1[n - 1 - i] = '1'
		else:
			s1[i] = s[i]
			s1[n - 1 - i] = s[n - 1 - i]
	s = ''
	s = s.join(s1)
	zero = s.count('0')
	if alag == 0:
		if zero == 0:
			print('DRAW')
		elif zero == 1 or zero % 2 == 0:
			print('BOB')
		else:
			print('ALICE')
	elif alag == 1 and zero == 1:
		print('DRAW')
	else:
		print('ALICE')
t = int(input())
for i in range(1, t + 1):
	solve()


for _ in range(int(input())):
	n = int(input())
	s = input()
	a = 0
	b = 0
	ret = 0
	num = 0
	ret2 = 0
	for i in s:
		if i == '0':
			num += 1
	if n % 2 == 1 and s[n // 2] == '0':
		ret = 1
	for i in range(n // 2):
		if s[i] != s[n - 1 - i]:
			ret2 += 1
	if ret2 == 1 and ret == 1 and (num == 2):
		print('DRAW')
	elif ret + ret2 == 0 or ret == num:
		print('BOB')
	else:
		print('ALICE')


for _ in range(int(input())):
	input()
	inp = str(input())
	zz = 0
	zo = 0
	for i in range(len(inp)):
		if inp[i] == inp[-i - 1] and inp[i] == '0':
			zz += 1
		if inp[i] != inp[-i - 1]:
			zo += 1
	win = 0
	zo /= 2
	if zo == 0:
		if zz % 2 == 0 and zz >= 2 or zz == 1:
			win = -1
		if zz % 2 == 1 and zz > 1:
			win = 1
	elif not (zz == zo and zz == 1):
		win = 1
	if win == 1:
		print('ALICE')
	if win == -1:
		print('BOB')
	if win == 0:
		print('DRAW')


from sys import stdin, stdout
from collections import deque
import bisect
import math
R = lambda : stdin.readline().strip()
RL = lambda f=None: list(map(f, R().split(' '))) if f else list(R().split(' '))
output = lambda x: stdout.write(str(x) + '\n')
output_list = lambda x: output(' '.join(map(str, x)))
T = int(input())
for _ in range(T):
	n = int(R())
	s = input()
	count = 0
	left = s[:n // 2]
	right = s[(n + 1) // 2:n]
	req = 0
	for i in range(len(left)):
		if left[i] != right[len(left) - 1 - i]:
			req += 1
	if req == 0:
		for i in range(n):
			if s[i] == '0':
				count += 1
		if count % 2 == 0:
			print('BOB')
		elif count == 1:
			print('BOB')
		else:
			print('ALICE')
	else:
		for i in range(n):
			if s[i] == '0':
				count += 1
		if req == 1 and count == 2:
			print('DRAW')
		else:
			print('ALICE')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	distToPal = 0
	zeroPairs = 0
	centerZero = n % 2 == 1 and s[n // 2] == '0'
	i = 0
	j = n - 1
	while i < j:
		if s[i] != s[j]:
			distToPal += 1
		elif s[i] == s[j] == '0':
			zeroPairs += 1
		i += 1
		j -= 1
	zeroCount = s.count('0')
	if distToPal == 0:
		if zeroCount == 0:
			print('DRAW')
		elif zeroCount % 2 == 0 or zeroCount == 1:
			print('BOB')
		else:
			print('ALICE')
	elif zeroPairs == 0 and distToPal == 1 and centerZero:
		print('DRAW')
	else:
		print('ALICE')


def is_palin(s):
	return ''.join(reversed(s)) == s

def if_palin(n, s):
	if n % 2 == 0:
		return 'BOB'
	else:
		count = 0
		for j in s:
			if j == '0':
				count += 1
		if count == 1:
			return 'BOB'
		elif count == 2 and s[n // 2] == '0':
			return 'DRAW'
		elif count > 2 and s[n // 2] == '0':
			return 'ALICE'
		elif count >= 2 and s[n // 2] == '1':
			return 'BOB'

def if_not_palin(n, s):
	if n % 2 == 0:
		return 'ALICE'
	count = 0
	for i in s:
		if i == '0':
			count += 1
		if count > 2:
			return 'ALICE'
	if count == 2 and s[n // 2] == '0':
		return 'DRAW'
	return 'ALICE'

def solve(n, s):
	if is_palin(s):
		ans = if_palin(n, s)
	else:
		ans = if_not_palin(n, s)
	return ans
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	result = solve(n, s)
	print(result)


for _ in range(int(input())):
	input()
	s = input()
	n = s.count('0')
	difference = 0
	begin = 0
	end = len(s) - 1
	while end >= begin:
		if s[begin] != s[end]:
			difference += 1
		begin += 1
		end -= 1
	if difference == 0:
		if n == 0:
			print('DRAW')
		elif n == 1 or n % 2 == 0:
			print('BOB')
		else:
			print('ALICE')
	elif difference == 1 and s.count('0') == 2:
		print('DRAW')
	else:
		print('ALICE')


for _ in range(int(input())):
	n = int(input())
	a = [int(x) for x in input()]
	fl = 1
	for i in range(n // 2):
		if a[i] != a[n - i - 1]:
			fl = 0
	if sum(a) == len(a):
		print('DRAW')
	elif fl:
		if n % 2 == 0:
			print('BOB')
		elif a[n // 2] == 1:
			print('BOB')
		elif sum(a) == n - 1:
			print('BOB')
		else:
			print('ALICE')
	elif n % 2 == 0 or a[n // 2] == 1:
		print('ALICE')
	elif sum(a) == n - 2:
		print('DRAW')
	else:
		print('ALICE')


from sys import stdin, gettrace
if gettrace():

	def inputi():
		return input()
else:

	def input():
		return next(stdin)[:-1]

	def inputi():
		return stdin.buffer.readline()

def solve():
	n = int(input())
	ss = input()
	mz = 0
	uz = 0
	for i in range(n // 2):
		if ss[i] == '0' and ss[-i - 1] == '0':
			mz += 1
		elif ss[i] == '0' or ss[-i - 1] == '0':
			uz += 1
	if uz == 0:
		if mz == 0 and ss[n // 2] != '0':
			print('DRAW')
		elif n % 2 == 0 or ss[n // 2] != '0' or mz == 0:
			print('BOB')
		else:
			print('ALICE')
	elif mz == 0 and uz == 1 and (n % 2 == 1) and (ss[n // 2] == '0'):
		print('DRAW')
	else:
		print('ALICE')

def main():
	t = int(input())
	for _ in range(t):
		solve()
main()


t = int(input())
(a, b, r) = (0, 0, 0)
for i in range(t):
	n = int(input())
	s = input()
	if s == s[::-1]:
		if s.count('0') == 1:
			print('BOB')
		elif s.count('0') % 2:
			print('ALICE')
		else:
			print('BOB')
	elif s.count('0') == 1:
		print('ALICE')
	elif s.count('0') != 2:
		print('ALICE')
	elif s.count('0') == 2:
		if len(s) % 2 == 0:
			print('ALICE')
		elif len(s) % 2 == 1 and s[len(s) // 2] == '0':
			print('DRAW')
		else:
			print('ALICE')


from sys import stdin, stdout
import math, bisect, heapq
from collections import Counter, deque, defaultdict
L = lambda : list(map(int, stdin.readline().strip().split()))
I = lambda : int(stdin.readline().strip())
S = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()

def pr(a):
	print(' '.join(list(map(str, a))))

def solve():
	n = I()
	s = S()
	x = s.count('0')
	if s == s[::-1]:
		if x == 1 or x % 2 == 0:
			print('BOB')
		else:
			print('ALICE')
	elif x == 2 and n % 2 and (s[n // 2] == '0'):
		print('DRAW')
	else:
		print('ALICE')
for _ in range(I()):
	solve()


import math
import random
import heapq, bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
import sys
import threading
from collections import defaultdict
threading.stack_size(10 ** 8)
mod = 10 ** 9 + 7
mod1 = 998244353
import os
import sys
from io import BytesIO, IOBase
sys.setrecursionlimit(300000)
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

class TreeNode:

	def __init__(self, k, v):
		self.key = k
		self.value = v
		self.left = None
		self.right = None
		self.parent = None
		self.height = 1
		self.num_left = 1
		self.num_total = 1

class AvlTree:

	def __init__(self):
		self._tree = None

	def add(self, k, v):
		if not self._tree:
			self._tree = TreeNode(k, v)
			return
		node = self._add(k, v)
		if node:
			self._rebalance(node)

	def _add(self, k, v):
		node = self._tree
		while node:
			if k < node.key:
				if node.left:
					node = node.left
				else:
					node.left = TreeNode(k, v)
					node.left.parent = node
					return node.left
			elif node.key < k:
				if node.right:
					node = node.right
				else:
					node.right = TreeNode(k, v)
					node.right.parent = node
					return node.right
			else:
				node.value = v
				return

	@staticmethod
	def get_height(x):
		return x.height if x else 0

	@staticmethod
	def get_num_total(x):
		return x.num_total if x else 0

	def _rebalance(self, node):
		n = node
		while n:
			lh = self.get_height(n.left)
			rh = self.get_height(n.right)
			n.height = max(lh, rh) + 1
			balance_factor = lh - rh
			n.num_total = 1 + self.get_num_total(n.left) + self.get_num_total(n.right)
			n.num_left = 1 + self.get_num_total(n.left)
			if balance_factor > 1:
				if self.get_height(n.left.left) < self.get_height(n.left.right):
					self._rotate_left(n.left)
				self._rotate_right(n)
			elif balance_factor < -1:
				if self.get_height(n.right.right) < self.get_height(n.right.left):
					self._rotate_right(n.right)
				self._rotate_left(n)
			else:
				n = n.parent

	def _remove_one(self, node):
		replacement = node.left or node.right
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = replacement
			else:
				node.parent.right = replacement
			replacement.parent = node.parent
			node.parent = None
		else:
			self._tree = replacement
			replacement.parent = None
		node.left = None
		node.right = None
		node.parent = None
		self._rebalance(replacement)

	def _remove_leaf(self, node):
		if node.parent:
			if AvlTree._is_left(node):
				node.parent.left = None
			else:
				node.parent.right = None
			self._rebalance(node.parent)
		else:
			self._tree = None
		node.parent = None
		node.left = None
		node.right = None

	def remove(self, k):
		node = self._get_node(k)
		if not node:
			return
		if AvlTree._is_leaf(node):
			self._remove_leaf(node)
			return
		if node.left and node.right:
			nxt = AvlTree._get_next(node)
			node.key = nxt.key
			node.value = nxt.value
			if self._is_leaf(nxt):
				self._remove_leaf(nxt)
			else:
				self._remove_one(nxt)
			self._rebalance(node)
		else:
			self._remove_one(node)

	def get(self, k):
		node = self._get_node(k)
		return node.value if node else -1

	def _get_node(self, k):
		if not self._tree:
			return None
		node = self._tree
		while node:
			if k < node.key:
				node = node.left
			elif node.key < k:
				node = node.right
			else:
				return node
		return None

	def get_at(self, pos):
		x = pos + 1
		node = self._tree
		while node:
			if x < node.num_left:
				node = node.left
			elif node.num_left < x:
				x -= node.num_left
				node = node.right
			else:
				return (node.key, node.value)
		raise IndexError('Out of ranges')

	@staticmethod
	def _is_left(node):
		return node.parent.left and node.parent.left == node

	@staticmethod
	def _is_leaf(node):
		return node.left is None and node.right is None

	def _rotate_right(self, node):
		if not node.parent:
			self._tree = node.left
			node.left.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.left
			node.left.parent = node.parent
		else:
			node.parent.right = node.left
			node.left.parent = node.parent
		bk = node.left.right
		node.left.right = node
		node.parent = node.left
		node.left = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	def _rotate_left(self, node):
		if not node.parent:
			self._tree = node.right
			node.right.parent = None
		elif AvlTree._is_left(node):
			node.parent.left = node.right
			node.right.parent = node.parent
		else:
			node.parent.right = node.right
			node.right.parent = node.parent
		bk = node.right.left
		node.right.left = node
		node.parent = node.right
		node.right = bk
		if bk:
			bk.parent = node
		node.height = max(self.get_height(node.left), self.get_height(node.right)) + 1
		node.num_total = 1 + self.get_num_total(node.left) + self.get_num_total(node.right)
		node.num_left = 1 + self.get_num_total(node.left)

	@staticmethod
	def _get_next(node):
		if not node.right:
			return node.parent
		n = node.right
		while n.left:
			n = n.left
		return n

class SegmentTree1:

	def __init__(self, data, default=2 ** 51, func=lambda a, b: a & b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: max(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

def powm(a, n, m):
	if a == 1 or n == 0:
		return 1
	if n % 2 == 0:
		s = powm(a, n // 2, m)
		return s * s % m
	else:
		return a * powm(a, n - 1, m) % m

def sort_list(list1, list2):
	zipped_pairs = zip(list2, list1)
	z = [x for (_, x) in sorted(zipped_pairs)]
	return z

def product(l):
	por = 1
	for i in range(len(l)):
		por *= l[i]
	return por

def binarySearchCount(arr, n, key):
	left = 0
	right = n - 1
	count = 0
	while left <= right:
		mid = int((right + left) / 2)
		if arr[mid] < key:
			count = mid + 1
			left = mid + 1
		else:
			right = mid - 1
	return count

def countdig(n):
	c = 0
	while n > 0:
		n //= 10
		c += 1
	return c

def binary(x, length):
	y = bin(x)[2:]
	return y if len(y) >= length else '0' * (length - len(y)) + y

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
	return n - leftGreater
for ik in range(int(input())):
	n = int(input())
	s = list(input())
	zer = s.count('0')
	c = 0
	for i in range(n // 2):
		if s[i] != s[n - 1 - i]:
			c += 1
	if n % 2 == 1 and s[n // 2] == '0':
		if zer > 2:
			print('ALICE')
		elif zer == 2:
			print('DRAW')
		else:
			print('BOB')
	elif c > 0:
		print('ALICE')
	else:
		print('BOB')


for _ in range(int(input())):
	n = int(input())
	s = input()
	count = 0
	d = 0
	for i in range(n):
		if s[i] == '0':
			count += 1
		if s[i] != s[n - 1 - i]:
			d += 1
	d = d // 2
	count -= d
	if count == 0:
		print('ALICE')
		continue
	if d == 0:
		if count % 2 == 1:
			if count == 1:
				print('BOB')
			else:
				print('ALICE')
		else:
			print('BOB')
	elif count == 1 and d == 1:
		print('DRAW')
		continue
	else:
		print('ALICE')


import sys, os, io
input = sys.stdin.readline
for _ in range(int(input())):
	n = int(input())
	s = input().strip()
	cnt = 0
	for i in range(n):
		if s[i] != s[n - i - 1]:
			cnt += 1
	cnt //= 2
	if cnt == 0:
		cnt = s.count('0')
		if n % 2 == 1 and s[n // 2] == '0':
			if cnt == 1:
				print('BOB')
			elif cnt == 2:
				print('DRAW')
			else:
				print('ALICE')
		else:
			print('BOB')
	elif cnt >= 2:
		print('ALICE')
	else:
		zero = s.count('0')
		flag = 0
		if n % 2 == 1 and s[n // 2] == '0':
			if zero == 2:
				print('DRAW')
				flag = 1
		elif zero % 2 == 0:
			print('DRAW')
			flag = 1
		if flag == 0:
			print('ALICE')


for t in range(int(input())):
	n = int(input())
	s = input()
	z1 = 0
	for i in range(n // 2):
		if s[i] != s[n - i - 1]:
			z1 += 1
	if z1 > 1:
		print('ALICE')
	elif z1 == 1 and s.count('0') == 2:
		print('DRAW')
	elif z1 == 1:
		print('ALICE')
	elif z1 == 0:
		z = s.count('0')
		if z == 1 or z % 2 == 0:
			print('BOB')
		else:
			print('ALICE')


for _ in range(int(input())):
	n = int(input())
	s = input()
	if s == s[::-1]:
		z = s.count('0')
		if z == 1 or z % 2 == 0:
			print('BOB')
		else:
			print('ALICE')
	else:
		(l, r) = (0, n - 1)
		uncount = 0
		while l < r:
			if s[l] != s[r]:
				uncount += 1
			l += 1
			r -= 1
		if uncount == 1 and s.count('0') == 2:
			print('DRAW')
		else:
			print('ALICE')


from sys import stdin, stdout
input = stdin.readline

def output(ans):
	stdout.write('{}\n'.format(ans))
for _ in range(int(input())):
	n = int(input())
	s = input()
	(cp, rem) = (0, 0)
	(i, j) = (0, n - 1)
	while i < j:
		if s[i] == '1' and s[j] == '1':
			pass
		elif s[i] == '0' and s[j] == '0':
			cp += 1
		elif s[i] == '0' or s[j] == '0':
			rem += 1
		i += 1
		j -= 1
	check = False
	if i == j and s[i] == '0':
		check = True
	(a, b) = (0, 0)
	if cp == 0 and rem == 0:
		a += check == True
		b = 0
	elif cp == 0:
		a += check == True
		b = rem
	elif rem == 0:
		if check:
			a = 1 + (cp - 1)
			b = cp + 1
		else:
			a = cp + 1
			b = cp - 1
	elif check == False:
		a = cp
		b = cp + rem
	else:
		a = cp
		b = rem + cp + 1
	if a > b:
		output('BOB')
	elif b > a:
		output('ALICE')
	else:
		output('DRAW')


def when_palindrome(n, st):
	if st == ''.join(['1'] * n):
		print('DRAW')
		return
	if n == 1 or n % 2 == 0:
		print('BOB')
	else:
		count1 = 0
		count0 = 0
		for i in st:
			if i == '1':
				count1 += 1
			else:
				count0 += 1
		if count0 == 1 and count1 == n - 1:
			print('BOB')
			return
		mid = n // 2
		if st[mid] == '1':
			print('BOB')
		else:
			print('ALICE')

def fun(n, st):
	if st == st[::-1]:
		when_palindrome(n, st)
	elif n % 2 == 0:
		print('ALICE')
	else:
		mid = n // 2
		count1 = 0
		count0 = 0
		for i in st:
			if i == '1':
				count1 += 1
			else:
				count0 += 1
		if count0 == 2 and st[mid] == '0':
			print('DRAW')
			return
		print('ALICE')
T = int(input())
for i in range(T):
	n = int(input())
	st = input()
	fun(n, st)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
from itertools import accumulate
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in st()]
for _ in range(val()):
	n = val()
	l = st()
	mid = 0
	if n & 1 and l[n // 2] == '0':
		mid = 1
	palins = ons = 0
	for i in range(n // 2):
		if l[i] == l[n - i - 1] == '0':
			palins += 1
	for i in range(n):
		if l[i] != l[n - i - 1] and l[i] == '0':
			ons += 1
	if not mid and (not palins) and (not ons):
		print('DRAW')
		continue
	if mid:
		if not ons:
			if palins:
				print('ALICE')
			else:
				print('BOB')
		elif ons == 1:
			if palins:
				print('ALICE')
			else:
				print('DRAW')
		elif palins:
			print('ALICE')
		else:
			print('ALICE')
	elif not ons:
		if palins:
			print('BOB')
		else:
			print('DRAW')
	elif ons == 1:
		print('ALICE')
	else:
		print('ALICE')


def solve():
	N = int(input())
	S = input()
	cnt0 = S.count('0')
	cnt01 = 0
	for i in range(N // 2):
		if S[i] != S[N - 1 - i]:
			cnt01 += 1
	cnt00 = cnt0 - cnt01
	if cnt0 == 0:
		return 'DRAW'
	if cnt01 == 0:
		if cnt0 == 1:
			return 'BOB'
		elif cnt0 % 2 == 1:
			return 'ALICE'
		else:
			return 'BOB'
	elif cnt01 == 1 and cnt00 == 1:
		return 'DRAW'
	else:
		return 'ALICE'
T = int(input())
for i in range(T):
	print(solve())


for _ in range(int(input())):
	n = int(input())
	s = input()
	l = []
	for i in s:
		l.append(int(i))
	i = 0
	j = n - 1
	unbalance = 0
	while i <= j:
		if l[i] != l[j]:
			l[i] = 1
			l[j] = 1
			unbalance += 1
		i += 1
		j -= 1
	zero = 0
	for i in l:
		if i == 0:
			zero += 1
	if unbalance == 0:
		if zero % 2 == 1 and zero != 1:
			print('ALICE')
		else:
			print('BOB')
	elif s[n // 2] == '0' and zero + unbalance == 2 and (n % 2 == 1):
		print('DRAW')
	else:
		print('ALICE')


def palindrome(s):
	n = len(s)
	for i in range((n + 1) // 2):
		if s[i] != s[n - i - 1]:
			return 0
	return 1

def one(s):
	n = len(s)
	c = 0
	for i in range((n + 1) // 2):
		if s[i] != s[n - i - 1]:
			c += 1
	return c
for _ in range(int(input())):
	n = int(input())
	s = input()
	c = s.count('0')
	if n % 2 and s[n // 2] == '0':
		if c > 2:
			print('ALICE')
		elif c == 2:
			print('DRAW')
		else:
			print('BOB')
	elif palindrome(s):
		print('BOB')
	else:
		print('ALICE')


def cp(l):
	k = l.copy()
	k.reverse()
	return k == l
t = int(input())
for _ in range(t):
	n = int(input())
	arr = list(map(int, list(input())))
	b = n - sum(arr)
	if cp(arr):
		if b == 0:
			print('DRAW')
			continue
		if b % 2 == 0:
			print('BOB')
			continue
		if b == 1:
			print('BOB')
			continue
		if b % 2 == 1:
			print('ALICE')
			continue
	elif arr[n // 2] == 0 and n % 2 == 1 and (b == 2):
		print('DRAW')
		continue
	else:
		print('ALICE')


import math
from itertools import combinations as cb
from itertools import permutations as pr
from collections import defaultdict as df
from collections import deque as dq

def ispalindrome(s, n):
	(cnt0, cnt1) = (0, 0)
	for i in range(n):
		if s[i] == '1':
			cnt1 += 1
	cnt0 = n - cnt1
	(al, bo) = (0, 0)
	if cnt1 == n:
		return 'DRAW'
	elif cnt0 == 1 or cnt0 % 2 == 0:
		return 'BOB'
	else:
		return 'ALICE'
for _ in range(int(input())):
	n = int(input())
	s = input()
	if s == s[::-1]:
		print(ispalindrome(s, n))
	else:
		(cnt0, cnt1) = (0, 0)
		a = []
		for i in range(n):
			if s[i] == '0':
				cnt0 += 1
			a.append(s[i])
		b = a.copy()
		c = a.copy()
		if cnt0 == 1:
			print('ALICE')
		elif cnt0 == 2:
			for i in range(n):
				if b[i] == '0':
					b[i] = '1'
					break
			b = ''.join(b)
			for i in range(n - 1, -1, -1):
				if c[i] == '0':
					c[i] = '1'
					break
			c = ''.join(c)
			if b == b[::-1] or c == c[::-1]:
				print('DRAW')
			else:
				print('ALICE')
		else:
			print('ALICE')


from sys import stdin, stdout
from math import gcd, sqrt, factorial, pi, inf
from collections import deque, defaultdict
from bisect import bisect, bisect_left
from time import time
from itertools import permutations as per
input = stdin.readline
R = lambda : map(int, input().split())
I = lambda : int(input())
S = lambda : input().rstrip('\r\n')
L = lambda : list(R())
P = lambda x: stdout.write(str(x) + '\n')
lcm = lambda x, y: x * y // gcd(x, y)
nCr = lambda x, y: f[x] * inv(f[y] * f[x - y] % N) % N
inv = lambda x: pow(x, N - 2, N)
sm = lambda x: (x ** 2 + x) // 2
N = 10 ** 9 + 7
for _ in range(I()):
	n = I()
	s = S()
	a = s.count('0')
	if s == s[::-1]:
		print('BOB' if a == 1 or a % 2 == 0 else 'ALICE')
		continue
	dif = 0
	for i in range(n // 2):
		if s[i] != s[-1 - i]:
			dif += 1
	if dif == 1 and a == 2 and n % 2:
		print('DRAW')
		continue
	print('ALICE')


t = int(input())
for tc in range(t):
	n = int(input())
	s = input()
	if s.count('0') == 2 and n % 2 == 1 and (s[n // 2] == '0'):
		print('DRAW')
		continue
	if s == s[::-1]:
		if s.count('0') % 2 == 0 or s.count('0') == 1:
			print('BOB')
		else:
			print('ALICE')
	else:
		print('ALICE')


def fn(z):
	if z == 0:
		return (0, 0)
	elif z % 2 == 0:
		return (z // 2 + 1, z // 2 - 1)
	elif z == 1:
		return (1, 0)
	else:
		return ((z - 1) // 2, (z - 1) // 2 + 1)

def ans(s, n):
	right = 0
	wrong = 0
	for i in range(n):
		if s[i] == '0' and s[i] == s[n - i - 1]:
			right += 1
		elif s[i] == '0':
			wrong += 1
	(a, b) = fn(right)
	if wrong == 0:
		if a > b:
			print('BOB')
		elif b > a:
			print('ALICE')
		else:
			print('DRAW')
	elif wrong == 1 and right == 1 and (n % 2 == 1) and (s[n // 2] == '0'):
		print('DRAW')
	else:
		print('ALICE')
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	ans(s, n)


for _ in range(int(input())):
	k = int(input())
	n = input()
	A = 0
	B = 0
	C = False
	for i in range(k // 2):
		if n[i] != n[k - i - 1]:
			A += 1
		elif n[i] == '0':
			B += 1
	if k % 2 == 1:
		C = n[k // 2] == '0'
	if not C:
		if A > 0:
			print('ALICE')
		else:
			print('BOB')
	elif A == 0:
		if B == 0:
			print('BOB')
		else:
			print('ALICE')
	elif A == 1:
		if B == 0:
			print('DRAW')
		else:
			print('ALICE')
	else:
		print('ALICE')


import os, sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
from math import ceil, log2, gcd
from bisect import bisect_right
from _collections import deque
mod = 10 ** 9 + 7

def ispal():
	ct = 0
	for i in range((n + 1) // 2):
		if a[i] != a[-(i + 1)]:
			ct += 1
	return ct
for _ in range(int(input())):
	n = int(input())
	a = [int(i) for i in input()]
	pal = ispal()
	if pal == 0:
		z = a.count(0)
		if z == 1 or not z % 2:
			print('BOB')
		else:
			print('ALICE')
	elif pal == 1:
		z = a.count(0)
		if z == 2:
			print('DRAW')
		else:
			print('ALICE')
	else:
		print('ALICE')


t = int(input())
for j in range(t):
	n = int(input())
	s = input()
	add = 0
	l = []
	for i in range(n):
		l.append(int(s[i]))
		add += l[i]
	if s != s[::-1]:
		if add == n - 2 and n % 2 == 1 and (l[n // 2] == 0):
			print('DRAW')
		else:
			print('ALICE')
	elif add != n - 1 and n % 2 == 1 and (l[n // 2] == 0):
		print('ALICE')
	else:
		print('BOB')


for _ in range(int(input())):
	n = int(input())
	s = input()
	c = 0
	for i in s:
		if i == '0':
			c += 1
	if s == s[::-1]:
		if c > 1 and s[n // 2] == '0' and (n % 2 == 1):
			print('ALICE')
		else:
			print('BOB')
	elif c == 2 and s[n // 2] == '0' and (n % 2 == 1):
		print('DRAW')
	else:
		print('ALICE')


for pratyush in range(int(input())):
	n = int(input())
	s = str(input())
	c = s.count('0')
	if s == s[::-1]:
		if c % 2 and c != 1:
			print('ALICE')
		else:
			print('BOB')
	elif n % 2 and c == 2 and (s[n // 2] == '0'):
		print('DRAW')
	else:
		print('ALICE')


import sys
input = sys.stdin.readline
from sys import stdin, stdout
from collections import defaultdict, Counter
M = 10 ** 9 + 7

def main():
	for _ in range(int(input())):
		n = int(input())
		s = input().strip()
		w = 0
		os = 0
		mid = 0
		for i in range(n // 2):
			if s[i] != s[n - i - 1]:
				w += 1
			elif s[i] == '0':
				os += 2
		if n % 2 and s[n // 2] == '0':
			mid = 1
		if w == 0:
			if mid == 1 and os == 0:
				print('BOB')
			elif mid == 1:
				print('ALICE')
			else:
				print('BOB')
		elif w == 1:
			if mid == 1:
				if os == 0:
					print('DRAW')
				else:
					print('ALICE')
			else:
				print('ALICE')
		else:
			print('ALICE')
main()


import os
import sys
from math import *
from collections import *
from heapq import *
from bisect import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
ALPHA = 'abcde'
M = 10 ** 9 + 7
EPS = 1e-06

def Ceil(a, b):
	return a // b + int(a % b > 0)

def INT():
	return int(input())

def STR():
	return input()

def INTs():
	return tuple(map(int, input().split()))

def ARRINT():
	return [int(i) for i in input().split()]

def ARRSTR():
	return [i for i in input().split()]

def solve(S):
	n = len(S)
	mid = 0
	X = 0
	Y = 0
	if n % 2 and S[n // 2] == '0':
		mid = 1
	for i in range(n // 2):
		if S[i] == '0' and S[n - 1 - i] == '0':
			X += 1
	for i in range(n):
		if S[i] == '0' and S[n - 1 - i] == '1':
			Y += 1
	if Y == 0:
		if X == 0:
			if mid == 0:
				print('DRAW')
			else:
				print('BOB')
		elif mid == 0:
			print('BOB')
		else:
			print('ALICE')
	elif Y == 1:
		if X == 0 and mid == 1:
			print('DRAW')
		elif mid == 0:
			print('ALICE')
		else:
			print('ALICE')
	else:
		print('ALICE')
for _ in range(INT()):
	_ = INT()
	solve(STR())


t = int(input())
for k in range(t):
	n = int(input())
	str = input()
	str1 = str[::-1]
	zero = 0
	if str == str1:
		zero = zero + str.count('0')
		if zero == 0:
			print('DRAW')
		elif zero == 1:
			print('BOB')
		elif zero % 2 == 0:
			print('BOB')
		else:
			print('ALICE')
	else:
		zero = zero + str.count('0')
		p = int(str[n // 2])
		if n % 2 != 0 and zero == 2 and (p == 0):
			print('DRAW')
		else:
			print('ALICE')


import sys
from collections import *
input = sys.stdin.readline
cas = int(input())
while cas:
	cas -= 1
	n = int(input())
	s = list(input())
	s = s[:-1]
	t = s[::-1]
	if s == t:
		sl = s.count('0')
		if sl == 1:
			print('BOB')
		elif n % 2 and s[(n - 1) // 2] == '0':
			print('ALICE')
		else:
			print('BOB')
	else:
		sl = s.count('0')
		if sl == 2:
			cnt = 0
			for i in range(n):
				if s[i] == '0' and t[i] == '0':
					cnt += 1
			if cnt == 0:
				print('ALICE')
			else:
				print('DRAW')
		else:
			print('ALICE')


def check(s: str) -> bool:
	L = 0
	R = len(s) - 1
	d = 0
	while L <= R:
		if s[L] != s[R]:
			d += 1
		L += 1
		R -= 1
	return d

def solve(s: str) -> str:
	cnt = s.count('0')
	d = check(s)
	if d == 0:
		if cnt % 2 == 0:
			return 'BOB'
		elif cnt == 1:
			return 'BOB'
		else:
			return 'ALICE'
	else:
		cnt -= d
		if cnt % 2 == 0:
			return 'ALICE'
		elif cnt == 1:
			if cnt == d:
				return 'DRAW'
			else:
				return 'ALICE'
		else:
			return 'ALICE'
for _ in range(int(input())):
	input()
	s = input()
	print(solve(s))


def Game(s):
	counter = s.count('0')
	count_1 = 0
	n = len(s)
	for i in range(n // 2 + 1):
		if (s[i] == '1' or s[n - 1 - i] == '1') and s[i] != s[n - 1 - i]:
			count_1 += 1
	if s == s[::-1]:
		if counter == 1:
			return 'BOB'
		if counter % 2 == 0:
			return 'BOB'
		else:
			return 'ALICE'
	elif counter == 2 and count_1 == 1:
		return 'DRAW'
	return 'ALICE'
t = int(input())
for i in range(t):
	n = int(input())
	s = input()
	print(Game(s))


def palindrome(s):
	if len(s) == s.count('1'):
		print('DRAW')
		return
	if s.count('0') % 2 == 0:
		print('BOB')
		return
	t = len(s) // 2
	if s[t] == '0' and s.count('0') > 1:
		print('ALICE')
		return
	print('BOB')
a = int(input())
for i in range(a):
	s = int(input())
	s = input()
	if s == s[::-1]:
		palindrome(s)
		continue
	c1 = 0
	c2 = 0
	c3 = 0
	flag = 0
	if len(s) % 2 == 1 and s[len(s) // 2] == '0':
		flag = 1
	for i in range(len(s) // 2):
		if s[i] == s[-1 * (i + 1)]:
			if s[i] == '0':
				c3 += 1
		else:
			c2 += 1
	if c2 == 1 and flag == 1 and (c3 == 0):
		print('DRAW')
		continue
	print('ALICE')


from sys import stdin
t = int(stdin.readline())
for _ in range(t):
	n = int(stdin.readline())
	s = stdin.readline()[:-1]
	c = s.count('0')
	if s == s[::-1]:
		if c == 0:
			print('DRAW')
		elif c == 1 or c % 2 == 0:
			print('BOB')
		elif c % 2 == 1:
			print('ALICE')
	elif n % 2 == 1 and c == 2 and (s[n // 2] == '0'):
		print('DRAW')
	else:
		print('ALICE')


import sys, math
import io, os

def data():
	return sys.stdin.readline().strip()

def mdata():
	return list(map(int, data().split()))

def outl(var):
	sys.stdout.write(' '.join(map(str, var)) + '\n')

def out(var):
	sys.stdout.write(str(var) + '\n')
mod = 998244353

def is_pallindrome(s):
	cnt = 0
	for i in range(len(s) // 2):
		if s[i] != s[~i]:
			cnt += 1
	return cnt
for t in range(int(data())):
	n = int(data())
	s = data()
	a = 0
	for i in s:
		if i == '0':
			a += 1
	cnt = is_pallindrome(s)
	if cnt == 0:
		if a % 2 == 0:
			out('BOB')
		elif a == 1:
			out('BOB')
		else:
			out('ALICE')
	elif cnt > 1:
		out('ALICE')
	elif a == 2:
		out('DRAW')
	else:
		out('ALICE')


import sys
import math
import random
from queue import PriorityQueue as PQ
from bisect import bisect_left as BSL
from bisect import bisect_right as BSR
from collections import OrderedDict as OD
from collections import Counter
from itertools import permutations
mod = 1000000007
MOD = mod
try:
	sys.stdin = open('actext.txt', 'r')
	OPENFILE = 1
except:
	pass

def get_ints():
	return map(int, input().split())

def palindrome(s):
	mid = len(s) // 2
	for i in range(mid):
		if s[i] != s[len(s) - i - 1]:
			return False
	return True

def check(i, n):
	if 0 <= i < n:
		return True
	else:
		return False

def checkPallindrome(s):
	for i in range(len(s) // 2):
		if s[i] != s[len(s) - i - 1]:
			return False
	return True

def easyversion(s, n):
	if len(s) % 2 == 0:
		print('BOB')
	elif s[len(s) // 2] == '0' and s.count('0') != 1:
		print('ALICE')
	else:
		print('BOB')
t = int(input())
for tt in range(t):
	n = int(input())
	s = input()
	if checkPallindrome(s):
		easyversion(s, n)
	elif len(s) % 2 == 0:
		print('ALICE')
	elif s[len(s) // 2] == '0' and s.count('0') == 2:
		print('DRAW')
	else:
		print('ALICE')


import math
t = int(input())
for j in range(t):

	def palincheck():
		if a.count('0') == 1:
			print('BOB')
		elif a.count('0') % 2 == 0:
			print('BOB')
		else:
			print('ALICE')
	n = int(input())
	a = input()
	m = math.ceil(n / 2) - 1
	if n % 2 == 0:
		last = list(a[m + 1:n])
		last.reverse()
		last = ''.join(last)
		if a[0:m + 1] == last:
			palincheck()
		else:
			print('ALICE')
	else:
		last = list(a[m + 1:n])
		last.reverse()
		last = ''.join(last)
		if a.count('0') == 2 and a[m] == '0':
			print('DRAW')
		elif a[0:m] == last:
			palincheck()
		else:
			print('ALICE')


from collections import defaultdict
for _ in range(int(input())):
	n = int(input())
	s = list(input())
	if s.count('0') == 0:
		print('DRAW')
	elif n == 1:
		if s[0] == '0':
			print('BOB')
		else:
			print('DRAW')
	elif s == s[::-1]:
		if s.count('0') % 2 == 0 or s.count('0') == 1:
			print('BOB')
		else:
			print('ALICE')
	else:
		l = 0
		r = n - 1
		c = 0
		zero = 0
		if n % 2:
			if s[n // 2] == '0':
				zero += 1
		while l < r:
			if s[l] != s[r]:
				c += 1
			elif s[l] == '0':
				zero += 2
			l += 1
			r -= 1
		if zero == 1 and c == 1:
			print('DRAW')
		else:
			print('ALICE')


t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	c = 0
	pc = 0
	i = 0
	j = n - 1
	while i < j:
		if s[i] == s[j] and s[i] == '0':
			c += 1
		elif s[i] != s[j]:
			pc += 1
		i += 1
		j -= 1
	a = 0
	b = 0
	a += pc
	c = 0
	for e in s:
		if e == '0':
			c += 1
	if pc == 0:
		if c == 0:
			print('DRAW')
		elif n % 2 == 1:
			if s[n // 2] == '0' and c == 1:
				print('BOB')
			elif s[n // 2] == '0' and c > 1:
				print('ALICE')
			else:
				print('BOB')
		else:
			print('BOB')
	elif pc == 1 and c == 2:
		print('DRAW')
	else:
		print('ALICE')


tt = int(input())
for _ in range(tt):
	n = int(input())
	(s, flag) = (input(), True)
	(cnt_1, cnt_0) = (0, 0)
	for i in range(n):
		if s[i] != s[n - i - 1]:
			flag = False
		if s[i] == '1' and s[n - i - 1] == '0':
			cnt_1 += 1
		cnt_0 += s[i] == '0'
	if flag:
		if cnt_0 == 1:
			print('BOB')
			continue
		if cnt_0 % 2:
			print('ALICE')
			continue
		print('BOB')
	elif cnt_1 == 1 and cnt_0 == 2:
		print('DRAW')
	else:
		print('ALICE')


t = int(input())
for _ in range(t):
	n = int(input())
	w = input()
	a = 0
	b = 0
	for i in range(len(w)):
		if i > n - 1 - i:
			break
		elif i == n - 1 - i and w[i] == '0':
			b += 1
		elif w[i] == w[n - 1 - i] and w[i] == '0':
			b += 2
		elif w[i] == '0' or w[n - 1 - i] == '0':
			a += 1
	if a > 0:
		if a == 1 and b == 1:
			print('DRAW')
		else:
			print('ALICE')
	elif b == 1 or b % 2 == 0:
		print('BOB')
	else:
		print('ALICE')


from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from collections import *
from itertools import *
from random import *
from bisect import *
from string import *
from queue import *
from heapq import *
from math import *
from re import *
from os import *

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = read(self._fd, max(fstat(self._fd).st_size, 8192))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))

def input():
	return stdin.readline().strip()

def fast():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (fast, lambda : map(int, z().split()))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer, end='\n'):
	stdout.write(str(answer) + end)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
num = int(z())
for _ in range(num):
	n = int(z())
	arr = fast()
	mid = arr[n // 2] == '0'
	zerr = 0
	mm = 0
	for i in range(n // 2):
		if arr[i] != arr[-i - 1]:
			mm += 1
		elif arr[i] == '0' and arr[-i - 1] == '0':
			zerr += 1
	if mm == 0:
		if n % 2:
			cnt = zerr
			if mid:
				if cnt >= 1:
					print('ALICE')
					continue
		print('BOB')
	elif mm == 1 and mid and n % 2 and (zerr == 0):
		print('DRAW')
	else:
		print('ALICE')


T = int(input())
t = 1
dic = {}

def getnext(twos, ones, nonsym, lastturn):
	if twos + ones + nonsym == 0:
		return 0
	if (twos, ones, nonsym, lastturn) in dic:
		return dic[twos, ones, nonsym, lastturn]
	(num1, num2, num3, num4) = (2147483647, 2147483647, 2147483647, 2147483647)
	if twos > 0:
		num1 = 1 - getnext(twos - 1, ones, nonsym + 1, 0)
	if ones > 0:
		num2 = 1 - getnext(twos, ones - 1, nonsym, 0)
	if lastturn == 0 and nonsym > 0:
		num3 = -getnext(twos, ones, nonsym, 1)
	if nonsym > 0:
		num4 = 1 - getnext(twos, ones, nonsym - 1, 0)
	output = min(num1, num2, num3, num4)
	dic[twos, ones, nonsym, lastturn] = output
	return output
while t <= T:
	n = int(input())
	s = input()
	twos = 0
	ones = 0
	nonsym = 0
	for i in range(n):
		if s[i] == '1':
			continue
		if s[i] == s[n - 1 - i]:
			if i != n - 1 - i:
				twos += 1
			else:
				ones += 1
		else:
			nonsym += 1
	twos = twos // 2
	ans = getnext(twos, ones, nonsym, 0)
	if ans > 0:
		print('BOB')
	elif ans == 0:
		print('DRAW')
	else:
		print('ALICE')
	t += 1


from math import *
import sys
input = sys.stdin.readline
sys.setrecursionlimit(3 * 10 ** 5)

def inp():
	return int(input())

def st():
	return input().rstrip('\n')

def lis():
	return list(map(int, input().split()))

def ma():
	return map(int, input().split())
t = inp()
while t:
	t -= 1
	n = inp()
	s = st()
	x = s.count('0')
	if s == s[::-1]:
		if x == 0:
			print('DRAW')
			continue
		if n % 2 == 0:
			print('BOB')
		elif x == 1 or x % 2 == 0:
			print('BOB')
		else:
			print('ALICE')
		continue
	elif x == 0:
		print('DRAW')
	elif n % 2 == 0:
		print('ALICE')
	elif x == 2 and s[n // 2] == '0':
		print('DRAW')
	else:
		print('ALICE')


import heapq
import math
tcs = int(input())
for tc in range(tcs):
	N = int(input())
	S = list(input().rstrip())
	n = len(S)
	zeros = S.count('0')
	if S == S[::-1]:
		if zeros > 1 and n % 2 == 1 and (S[n // 2] == '0'):
			print('ALICE')
		else:
			print('BOB')
	else:
		draw = False
		if n % 2 == 1:
			c = 0
			for i in range(n // 2):
				if S[i] != S[n - 1 - i]:
					c += 1
			if c == 1 and zeros == 2:
				draw = 1
		if draw:
			print('DRAW')
		else:
			print('ALICE')


from sys import stdin, stdout
input = stdin.readline

def f():
	global n, s
	if n % 2 == 0 or (n % 2 and s[n // 2] == '1'):
		a = s.count('0')
		if a == 0:
			print('DRAW')
		elif a // 2 % 2 == 0:
			print('BOB')
		else:
			print('BOB')
	else:
		a = s.count('0')
		a -= 1
		if a == 0:
			print('BOB')
		elif a // 2 % 2 == 0:
			print('ALICE')
		else:
			print('ALICE')
t = int(input())
for _ in range(t):
	n = int(input())
	s = input().strip()
	if s == s[::-1]:
		f()
		continue
	if n % 2 == 0 or (n % 2 and s[n // 2] == '1'):
		print('ALICE')
	else:
		a = s.count('0') - 1
		if a == 1:
			print('DRAW')
		else:
			print('ALICE')


for _ in range(int(input())):
	n = int(input())
	a = input()
	zero = 0
	rep = 0
	for i in range(n):
		if a[i] == '0':
			zero += 1
	for i in range(n // 2):
		if a[i] != a[n - i - 1]:
			rep += 1
	zero -= rep
	if zero == 0:
		print('ALICE')
	elif zero == 1:
		if rep == 0:
			print('BOB')
		elif rep == 1:
			print('DRAW')
		else:
			print('ALICE')
	elif zero % 2 == 0:
		if rep == 0:
			print('BOB')
		else:
			print('ALICE')
	else:
		print('ALICE')


for _ in range(int(input())):
	n = int(input())
	s = input()
	S = list(s)
	count = 0
	c_0 = s.count('0')
	for i in range(n // 2):
		if S[i] != S[n - 1 - i]:
			count += 1
	if n % 2 == 0:
		if count == 0:
			print('BOB')
		else:
			print('ALICE')
	elif S[n // 2] == '1':
		if count == 0:
			print('BOB')
		else:
			print('ALICE')
	elif count == 0:
		if c_0 > 1:
			print('ALICE')
		else:
			print('BOB')
	elif count == 1:
		if c_0 == 2:
			print('DRAW')
		else:
			print('ALICE')
	else:
		print('ALICE')


import sys
Z = sys.stdin.readline
O = []
for _ in range(int(Z())):
	n = int(Z())
	s = [*map(int, Z().strip())]
	e = m = o = 0
	for i in range(n // 2):
		(x, y) = (s[i], s[-1 - i])
		e += x ^ y
		o |= x == y == 0
	if n & 1:
		m = 1 - s[n // 2]
		e += m
	if m and e == 2 and (o < 1):
		O.append('DRAW')
	else:
		O.append(['ALICE', 'BOB'][e * (o - m + 2) < 2])
print('\n'.join(O))


def makePalin(s, n):
	count = 0
	for i in range(0, n // 2 + 1):
		if s[i] != s[n - 1 - i]:
			if s[i] == '1':
				s[n - 1 - i] = '1'
			else:
				s[i] = '1'
			count += 1
	return (s, count)
for i in range(int(input())):
	n = int(input())
	s = [c for c in input()]
	(s, cost) = makePalin(s, n)
	if cost == 0:
		count = 0
		for ch in s:
			if ch == '0':
				count += 1
		if count == 1 or count % 2 == 0:
			print('BOB')
		elif count % 2 == 1:
			print('ALICE')
		else:
			print('DRAW')
	else:
		count = 0
		for ch in s:
			if ch == '0':
				count += 1
		if count == 1 and cost == 1:
			print('DRAW')
		else:
			print('ALICE')


def freqn(l):
	a = 0
	for i in range(len(l)):
		if l[i] == '0':
			a = a + 1
	return a

def diffpal(l):
	b = l[::-1]
	if l == b:
		if len(l) % 2 == 0:
			return 'BOB'
		elif l[(len(l) - 1) // 2] == '0':
			if freqn(l) != 1:
				return 'ALICE'
			else:
				return 'BOB'
		else:
			return 'BOB'
	elif len(l) % 2 == 1 and freqn(l) == 2 and (l[(len(l) - 1) // 2] == '0'):
		return 'DRAW'
	else:
		return 'ALICE'
x = int(input())
m = []
for i in range(x):
	y = input()
	z = input()
	m.append(z)
for j in range(x):
	print(diffpal(m[j]))


t = int(input())
for i in range(t):
	n = int(input())
	a = input()
	c = a.count('0')
	if a[::-1] == a:
		if c == 1 or c % 2 == 0:
			print('BOB')
		else:
			print('ALICE')
	elif n % 2 == 0:
		print('ALICE')
	elif c == 2 and a[n // 2] == '0':
		print('DRAW')
	else:
		print('ALICE')


t = int(input())
import math
for i in range(0, t):
	n = int(input())
	s = input()
	if s == s[::-1]:
		if s.count('0') == 1:
			print('BOB')
		elif s.count('0') % 2 == 1:
			print('ALICE')
		elif s.count('0') % 2 == 0:
			print('BOB')
	elif len(s) % 2 == 1 and s[len(s) // 2] == '0' and (s.count('0') == 2):
		print('DRAW')
	else:
		print('ALICE')


import math
T = int(input())
for ti in range(T):
	N = int(input())
	string = input()

	def palindrome(st):
		for i in range(N):
			if st[i] != st[N - i - 1]:
				return False
		return True
	count = string.count('0')
	if palindrome(string):
		if count == 1:
			print('BOB')
		elif count % 2:
			print('ALICE')
		else:
			print('BOB')
	elif count == 2 and len(string) % 2 and (string[N // 2] == '0'):
		print('DRAW')
	else:
		print('ALICE')


def some_random_function():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function5():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)
import os, sys
from io import BytesIO, IOBase

def main():
	for _ in range(int(input())):
		n = int(input())
		s = input().strip()
		(pal, exc) = (0, 0)
		for i in range(n // 2):
			if s[i] != s[n - 1 - i]:
				pal += 1
			elif s[i] == '0':
				exc = 1
		if n & 1 and s[n // 2] == '0':
			if pal >= 2:
				print('ALICE')
			elif pal == 1:
				if not exc:
					print('DRAW')
				else:
					print('ALICE')
			elif not exc:
				print('BOB')
			else:
				print('ALICE')
		elif not pal:
			if not exc:
				print('DRAW')
			else:
				print('BOB')
		else:
			print('ALICE')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def some_random_function1():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function2():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function3():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function4():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function6():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function7():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)

def some_random_function8():
	x = 10
	x *= 100
	i_dont_know = x
	why_am_i_writing_this = x * x
	print(i_dont_know)
	print(why_am_i_writing_this)
main()


import sys
t = int(sys.stdin.readline())
for i in range(t):
	n = int(sys.stdin.readline())
	data = sys.stdin.readline().rstrip()
	zeros = 0
	for item in data:
		if item == '0':
			zeros += 1
	if data == data[::-1]:
		if zeros == 1 or zeros % 2 == 0:
			print('BOB')
		else:
			print('ALICE')
	elif zeros == 2 and len(data) % 2 == 1 and (data[len(data) // 2] == '0'):
		print('DRAW')
	else:
		print('ALICE')


import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
	n = int(input())
	S = input().strip()
	mid = 0
	X = 0
	Y = 0
	if n % 2 and S[n // 2] == '0':
		mid = 1
	for i in range(n // 2):
		if S[i] == '0' and S[n - 1 - i] == '0':
			X += 1
	for i in range(n):
		if S[i] == '0' and S[n - 1 - i] == '1':
			Y += 1
	if Y == 0:
		if X == 0:
			if mid == 0:
				print('DRAW')
			else:
				print('BOB')
			continue
		if mid == 0:
			print('BOB')
		else:
			print('ALICE')
		continue
	if Y == 1:
		if X == 0 and mid == 1:
			print('DRAW')
		elif mid == 0:
			print('ALICE')
		else:
			print('ALICE')
	else:
		print('ALICE')


def diff(s):
	ans = 0
	for i in range(len(s) // 2):
		if s[i] != s[n - i - 1]:
			ans += 1
	return ans

def fun(s):
	zz = s.count('0')
	if n % 2 and s[n // 2] == '0' and (zz > 2):
		print('ALICE')
	elif n % 2 and s[n // 2] == 0 and (zz == 2):
		print('DRAW')
	else:
		print('BOB')
t = int(input())
for _ in range(t):
	n = int(input())
	s = input()
	d = diff(s)
	if d == 0:
		fun(s)
		continue
	if d >= 2:
		print('ALICE')
		continue
	zz = s.count('0')
	if n % 2 and s[n // 2] == '0':
		if zz == 1:
			print('ALICE')
		elif zz == 2:
			print('DRAW')
		else:
			print('ALICE')
		continue
	if zz % 2:
		print('ALICE')
	else:
		print('DRAW')


def readArr():
	return [int(x) for x in input().split()]

def isPalindrome(s):
	n = len(s)
	for i in range(n // 2):
		if s[i] != s[n - i - 1]:
			return False
	return True

def solveB(N, s):
	zr = s.count('0')
	if zr % 2 == 0:
		print('BOB')
		return
	elif zr == 1:
		print('BOB')
		return
	else:
		print('ALICE')
		return

def solve():
	N = int(input())
	s = input()
	if isPalindrome(s):
		solveB(N, s)
	else:
		K = None
		for i in range(N):
			if s[i] == '1':
				continue
			k = s[:i] + '1' + s[i + 1:]
			if isPalindrome(k):
				K = k
		if K:
			if K.count('0') == 1:
				print('DRAW')
				return
			else:
				print('ALICE')
				return
		else:
			print('ALICE')
T = int(input())
for t in range(T):
	solve()


for s in [*open(0)][2::2]:
	s = s.strip()
	n = len(s)
	z = s.count('0')
	x = n & 1 & (s[n // 2] == '0')
	if s == s[::-1]:
		print('BAOLBI C E'[(z > 1) & x::2])
	else:
		print('ADLRIACWE'[(z == 2) & x::2])


t = int(input())
for i in range(t):
	length = int(input())
	Str = input()
	zeroNum = 0
	dif = 0
	for j in range(length):
		if Str[j] != Str[-j - 1]:
			dif += 1
		if Str[j] == '0':
			zeroNum += 1
	dif //= 2
	zeroNum -= dif
	if dif == 0:
		if zeroNum == 1:
			print('BOB')
		elif zeroNum % 2 == 1:
			print('ALICE')
		else:
			print('BOB')
	elif dif == 1:
		if zeroNum == 1:
			print('DRAW')
		else:
			print('ALICE')
	else:
		print('ALICE')


t = eval(input())
for i in range(t):
	n = eval(input())
	p = input()
	count = p.count('0')
	if count == 0:
		print('DRAW')
		continue
	if p[::-1] == p:
		if count == 1:
			print('BOB')
			continue
		if count % 2 == 0:
			print('BOB')
		else:
			print('ALICE')
	else:
		l = len(p)
		if count % 2 == 0:
			if count == 2:
				if l % 2 != 0 and p[int(l / 2)] == '0':
					print('DRAW')
				else:
					print('ALICE')
			else:
				print('ALICE')
		else:
			print('ALICE')


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(n, s) = (int(input()), input().strip())
	if s == s[::-1]:
		if not s.count('0') % 2 or s.count('0') == 1:
			print('BOB')
		else:
			print('ALICE')
	elif n % 2 and s.count('0') == 2 and (s[n // 2] == '0'):
		print('DRAW')
	else:
		print('ALICE')


from collections import Counter
for ttt in range(int(input())):
	n = int(input())
	s = input()
	if s == s[::-1]:
		if s.count('0') == 1:
			print('BOB')
			continue
		if s.count('0') == n:
			if s.count('0') % 2 == 0:
				print('BOB')
			else:
				print('ALICE')
			continue
		ss = s.count('0')
		if ss % 2:
			print('ALICE')
		else:
			print('BOB')
	elif s.count('0') == 2 and n % 2 and (s[n // 2] == '0'):
		print('DRAW')
	else:
		print('ALICE')


import os
import sys
from io import BytesIO, IOBase
from types import GeneratorType
from collections import defaultdict
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
sys.setrecursionlimit(2 * 10 ** 5)
for CASES in range(int(input())):
	n = int(input())
	s = input()
	num00 = 0
	num01 = 0
	middleiszero = 0
	for i in range(n):
		if i == n - i - 1:
			if s[i] == '0':
				middleiszero = 1
			break
		if s[i] == s[n - i - 1] and s[i] == '0':
			num00 += 1
		elif s[i] != s[n - i - 1] and (s[i] == '1' or s[n - i - 1] == '1'):
			num01 += 1
	if num01 == 0:
		if middleiszero and num00 > 0:
			print('ALICE')
		else:
			print('BOB')
	elif num00 == 0 and middleiszero == 1 and (num01 == 1):
		print('DRAW')
	else:
		print('ALICE')