13482 - Very beautiful subsequence   

Description

Given a sequence A = a1, a2, ..., aN.

A continuous subsequence A[L ... R] = aL, ..., aR of  A is called very beautiful if every element in A[L...R] is unique.

For example, if A = 3, 1, 2, 3, 4.

Then

  • A[1, 3] = 3, 1, 2 is very beautiful.
  • A[1, 4] = 3, 1, 2, 3 is not very beautiful because A[1] = A[4].
  • A[2, 5] = 1, 2, 3, 4 is very beautiful.

 

Please find the maximum length of very beautiful continuous subsequence of A.

 

Input

The first line of the input contains a number T — the number of test cases.

The first line of each test case contains a positive integer N — the length of A.

The second line of each test case contains N numbers — a1, a2, ..., aN.

 

For each test,

  1. T ≤ 10, N ≤ 103, |ai| ≤ 109 
  2. T ≤ 10, N ≤ 103, |ai| ≤ 109 
  3. T ≤ 10, N ≤ 103, |ai| ≤ 109 
  4. T ≤ 10, N ≤ 105, |ai| ≤ 109 
  5. T ≤ 10, N ≤ 105, |ai| ≤ 109 
  6. T ≤ 10, N ≤ 105, |ai| ≤ 109 

 

Output

For each test case, print the maximum length of very beautiful continuous subsequence.

 

Sample Input  Download

Sample Output  Download

Tags




Discuss