Given a sequence $A_1, A_2, \ldots, A_N$ of length $N$, where each number is between $1$ and $K$ inclusive. You need to process the following queries:
l r: output $\max\{|x - y| : l \le x, y \le r \text{ and } A_x = A_y\}$.
Input
The first line contains two integers $N$ and $K$, representing the length of the sequence and the range of values. Here $1 \le N \le 100{,}000$, $1 \le K \le 100{,}000$.
The second line contains $N$ integers $A_1, A_2, \ldots, A_N$, satisfying $1 \le A_i \le K$.
The third line contains an integer $M$, representing the number of queries, $1 \le M \le 100{,}000$.
The next $M$ lines each contain two integers $l, r$, representing a query, satisfying $1 \le l \le r \le N$.
Output
For each query, output the answer on a separate line.
Examples
Input 1
7 7 4 5 6 6 5 7 4 5 6 6 5 6 3 5 3 7 1 7
Output 1
0 0 1 1 6