시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 (추가 시간 없음) 1024 MB111100.000%

문제

You are given an array $a$ of length $n$. Define $\mathit{cnt}_x$ as the number of occurrences of $x$ in $a$.

Now you can do the following operation at most once: select a non-empty subarray $a_l, a_{l+1}, a_{l+2}, \ldots, a_r$ and an integer $k \in [-10^9, 10^9]$, and add $k$ to all the elements in the subarray.

Your first task is to find the maximum possible value of $W = \max\{\mathit{cnt}_x \mid x \in \mathbb{Z}\}$ after one operation. Your second task is to find all $v$ such that $\mathit{cnt}_v = W$ can be achieved after one operation.

입력

The first line contains an integer $T$ ($1 \leq T \leq 20$), the number of test cases.

Each test case consists of two lines. The first line contains a single integer $n$ ($2 \leq n \leq 2 \cdot 10^5$), and the second line contains $n$ integers denoting the array ($1 \le a_i \le 10^9$).

It is guaranteed that $\sum n \leq 5 \cdot 10^5$, and $a_i$ are not all the same.

출력

For each test case, output one integer on the first line, denoting the maximum value $W$. Then for all integers $v$ satisfying the condition, output them in ascending order.

예제 입력 1

4
5
1 2 3 2 1
5
1 1 3 1 1
6
2 4 2 4 8 8
5
1 2 3 4 5

예제 출력 1

4
1
5
1
4
2
4
8
2
1
2
3
4
5

노트

The values of $W$ for the test cases are $4$, $5$, $4$, $2$.