import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.Random;

public class MonteCarloDice {
	private static final long TIMELIMIT = 900000000;

	private static final Random R = new Random();

	private static String winner(List<Integer> A, List<Integer> B, String a, String t, String b, int tests) {
		long deadline = System.nanoTime() + TIMELIMIT;
		int check = 100;
		int counter = 0;
		for (int i = 0; i < tests; i++) {
			int sum = 0;
			for (int s : A) {
				sum += R.nextInt(s) + 1;
			}
			for (int s : B) {
				sum -= R.nextInt(s) + 1;
			}
			if (sum > 0) {
				counter++;
			} else if (sum < 0) {
				counter--;
			}
			if (counter % check == 0 && System.nanoTime() > deadline) {
				break;
			}
		}
		return counter > 0 ? a : counter == 0 ? t : b;
	}

	private static void read() throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		br.readLine();
		String[] line = br.readLine().split(" ");
		List<Integer> A = Arrays.stream(line).map(Integer::parseInt).toList();
		line = br.readLine().split(" ");
		List<Integer> B = Arrays.stream(line).map(Integer::parseInt).toList();
		br.close();
		System.out.println(winner(A, B, "ALICE", "TIED", "BOB", 10000));
	}

	public static void main(String[] args) throws IOException {
		read();
	}
}

