This page is still under construction.

Parts of this page are still being built. What you see may change.

Integer Game

Time limit5sMemory limit256 MB

Summary
Players alternately remove a number with no larger remaining neighbor from a row permutation, and whoever takes 1 wins, so decide the winner under optimal play.
Level

Hard8 of 10

Topics
Game theory, Dynamic programming
Solved
No attempts yet

Problem

Alice and Bob place NN squares in a row and play a game. Each square holds one of the numbers 11 through NN, and no number appears twice.

Alice starts, and the two players alternate turns. On a turn a player removes one number. A player may remove the number on a square only if neither square sharing an edge with it, that is the square immediately to its left and the square immediately to its right, holds a larger number. A square whose number is already removed is empty and does not block the removal, and the outside of the row does not block it either. Once a number is removed its square holds no number.

The player who removes 11 wins the game. Given the initial state, write a program that determines who wins when both players play optimally.

Input

The first line contains the number of test cases TT (1≤T≤1001 \le T \le 100).

The first line of each test case contains NN (1≤N≤1001 \le N \le 100). The second line contains the initial state of the game, from the leftmost square to the rightmost square. These numbers are a permutation that uses each of 11 through NN once.

Output

For each test case, print the name of the winner on its own line. Print Alice if Alice wins, and print Bob if Bob wins.

Examples2

  1. Example 1

    Input
    4
    4
    2 1 3 4
    4
    1 3 2 4
    3
    1 3 2
    6
    2 5 1 6 4 3
    
    Expected output
    Bob
    Alice
    Bob
    Alice
    
  2. Example 2

    Input
    6
    1
    1
    2
    1 2
    2
    2 1
    3
    1 2 3
    3
    3 2 1
    3
    2 1 3
    
    Expected output
    Alice
    Bob
    Bob
    Alice
    Alice
    Alice