��最短的连续区间[li,ri]，使得[xi,yi]属于 [li, ri]。</div></div></div></div></div><div class="row"><div class="column"><h4 class="ui top attached block header">输入格式</h4><div class="ui bottom attached segment font-content"><div style="position: relative; overflow: hidden;"><div class=content><div>第1行1个数n。</div>
<div>第2行n个数a1,...an(a1, . . . , an为1到n的排列)。</div>
<div>第3行1个数m。</div>
<div>第4行到第m+3行，每行2个数xi,yi(1 &le; xi &le; yi &le