PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GD0000189. Trò chơi chẵn – lẻ (Even-Odd Game)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Trò chơi chẵn – lẻ (Even-Odd Game)

Even-Odd Game

Source: Codeforces

Version: Phuoc Hung OJ (single-case adaptation where applicable)

Problem Statement

Alice and Bob alternately remove one positive integer from an array, Alice first. Alice scores the value of an even integer she removes, otherwise zero. Bob scores the value of an odd integer he removes, otherwise zero. Both play optimally to maximize their score difference. Determine the winner or a tie.

Input

The first line contains nn. The second contains nn positive integers aia_i.

Output

Print Alice, Bob, or Tie according to optimal play.

Subtasks

  • Subtask 1 (20 points): 1≤n≤121\le n\le 12; 1≤ai≤501\le a_i\le 50 for every 1≤i≤n1\le i\le n.
  • Subtask 2 (30 points): 1≤n≤30001\le n\le 3000; 1≤ai≤1000001\le a_i\le 100000 for every 1≤i≤n1\le i\le n.
  • Subtask 3 (50 points): 1≤n≤2000001\le n\le 200000; 1≤ai≤10000000001\le a_i\le 1000000000 for every 1≤i≤n1\le i\le n.

Examples

Example 1

Input

4
5 2 7 3

Output

Bob

Explanation

Sorted values are 7, 5, 3, 2. Alice discards 7, Bob scores 5, and neither scores on the final two turns. Bob wins.

Example 2

Input

3
3 2 1

Output

Tie

Explanation

Alice first discards 3, Bob discards 2, and Alice discards 1; no one scores, so the result is a tie.