Under construction

Still being built. Things may change

The Tape

Interview

Time limit1sMemory limit512 MB

Summary
Find the largest distance between two positions holding different values in each test case, printing BRAK if all values are equal.
Level

Easy3 of 10

Topics
Greedy, Array
Solved
No attempts yet

Problem

Jaś found a very long tape at home. Without a second thought he wrote a sequence of positive integers on it. Now he wants to find, among all pairs of positions holding different values, the pair that is farthest apart.

The distance between two numbers is the difference of their positions. Two adjacent numbers are at distance 11, two numbers separated by a single number (sharing a common neighbor) are at distance 22, and in general the number at position ii and the number at position jj are at distance ∣i−j∣|i - j|.

Report the largest possible distance between two positions whose values differ.

Input

The first line contains one integer mm (1≤m≤101 \le m \le 10), the number of test cases.

Each test case is given on two lines. The first line contains one integer nn (1≤n≤1051 \le n \le 10^5), the length of the sequence written on the tape. The second line contains nn integers aia_i (1≤ai≤1091 \le a_i \le 10^9) separated by single spaces.

Output

Print mm lines, one per test case.

If the sequence of the ii-th test case contains no pair of differing values, the ii-th line must contain the single word BRAK. Otherwise the ii-th line must contain one integer: the distance between the farthest pair of positions whose values differ.

Hint

In the first sample, one farthest pair of differing values is the first number (22) and the seventh number (55), which are at distance 66.

Examples1

  1. Example 1

    Input
    2
    8
    2 5 4 7 3 4 5 2
    3
    7 7 7
    
    Expected output
    6
    BRAK