The Tape
InterviewTime limit1sMemory limit512 MB
Find the largest distance between two positions holding different values in each test case, printing BRAK if all values are equal.
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 , two numbers separated by a single number (sharing a common neighbor) are at distance , and in general the number at position and the number at position are at distance .
Report the largest possible distance between two positions whose values differ.
Input
The first line contains one integer (), the number of test cases.
Each test case is given on two lines. The first line contains one integer (), the length of the sequence written on the tape. The second line contains integers () separated by single spaces.
Output
Print lines, one per test case.
If the sequence of the -th test case contains no pair of differing values, the -th line must contain the single word BRAK. Otherwise the -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 () and the seventh number (), which are at distance .