Artsem is on vacation and wants to buy souvenirs for his two teammates. There are *n* souvenir shops along the street. In *i*-th shop Artsem can buy one souvenir for *a*<sub class="lower-index">*i*</sub> dollars, and he cannot buy more than one souvenir in one shop. He doesn't want to introduce envy in his team, so he wants to buy two souvenirs with least possible difference in price.

Artsem has visited the shopping street *m* times. For some strange reason on the *i*-th day only shops with numbers from *l*<sub class="lower-index">*i*</sub> to *r*<sub class="lower-index">*i*</sub> were operating (weird? yes it is, but have you ever tried to come up with a reasonable legend for a range query problem?). For each visit, Artsem wants to know the minimum possible difference in prices of two different souvenirs he can buy in the opened shops.

In other words, for each Artsem's visit you should find the minimum possible value of |*a*<sub class="lower-index">*s*</sub> - *a*<sub class="lower-index">*t*</sub>| where *l*<sub class="lower-index">*i*</sub> ≤ *s*, *t* ≤ *r*<sub class="lower-index">*i*</sub>, *s* ≠ *t*.
The first line contains an integer *n* (2 ≤ *n* ≤ 10<sup class="upper-index">5</sup>).

The second line contains *n* space-separated integers *a*<sub class="lower-index">1</sub>, ..., *a*<sub class="lower-index">*n*</sub> (0 ≤ *a*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>).

The third line contains the number of queries *m* (1 ≤ *m* ≤ 3·10<sup class="upper-index">5</sup>).

Next *m* lines describe the queries. *i*-th of these lines contains two space-separated integers *l*<sub class="lower-index">*i*</sub> and *r*<sub class="lower-index">*i*</sub> denoting the range of shops working on *i*-th day (1 ≤ *l*<sub class="lower-index">*i*</sub> &lt; *r*<sub class="lower-index">*i*</sub> ≤ *n*).
none
n = int(input())
a = input().split()
a = [int(x) for x in a]
m = int(input())
l = []
r = []
for i in range(m):
    l_tmp, r_tmp = input().split()
    l.append(int(l_tmp)-1)
    r.append(int(r_tmp))

for i in range(m):
    section = sorted(a[l[i]:r[i]])
    min_diff = section[1] - section[0]
    for j in range(2, len(section)):
        diff = section[j] - section[j-1]
        if diff < min_diff:
            min_diff = diff
    print(min_diff)