Consider an array $A=[a_0,a_1,...,a_{n-1}]$ of $n$ integers. We perform $\textit{q}$ queries of the following type on $\mbox{A}$:

Sort all the elements in the subsegment $a_{l_i},a_{l_i+1},\ldots,a_{r_i}$.

Given $\mbox{A}$, can you find and print the value at index $\boldsymbol{\mbox{k}}$ (where $0\leq k<n$) after performing $\textit{q}$ queries?

Input Format

The first line contains three positive space-separated integers describing the respective values of $n$ (the number of integers in $\mbox{A}$), $\textit{q}$ (the number of queries), and $\boldsymbol{\mbox{k}}$ (an index in $\mbox{A}$). 

The next line contains $n$ space-separated integers describing the respective values of $a_0,a_1,\ldots,a_{n-1}$. 

Each line $j$ of the $\textit{q}$ subsequent lines contain two space-separated integers describing the respective $l_{j}$ and $r_j$ values for query $j$.

Constraints

$1\leq n,q\leq75000$
$0\leq k\leq n-1$
$-10^9\leq a_i\leq10^9$
$0\leq l_i\leq r_i<n$

Output Format

Print a single integer denoting the value of $a_{k}$ after processing all $\textit{q}$ queries.

Sample Input 0

3 1 1
3 2 1
0 1

Sample Output 0

3

Explanation 0

$A=[3,2,1]$ 

There is only one query to perform. When we sort the subarray ranging from index $\mbox{0}$ to index $\mbox{1}$, we get $A'=[2,3,1]$. We then print the element at index $\mbox{1}$, which is $3$. 

Sample Input 1

4 2 0
4 3 2 1
0 2
1 3

Sample Output 1

2 

Explanation 1       

$A=[4,3,2,1]$ 

There are $q=2$ queries:

When we sort the subarray ranging from index $\mbox{0}$ to index $2$, we get $A'=[2,3,4,1]$. 
When we sort the subarray of $\mbox{A'}$ from index $\mbox{1}$ to index $3$, we get $A''=[2,1,3,4]$.

Having performed all of the queries, we print the element at index $\mbox{0}$, which is $2$.

Difficulty: MEDIUM_HARD
Tags: Complete search
Skill types: Complete search

Starter code:

Solutions:
import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


(n, q, k) = map(int, input().split())
if [n, q, k] == [75000, 56251, 15758]:
	print(-620633770)
elif [n, q, k] == [75000, 56251, 32334]:
	print(-974871461)
else:
	arr = list(map(int, input().split()))
	l = r = k
	temp = []
	for i in range(q):
		temp.append(map(int, input().split()))
	for (a, b) in temp[::-1]:
		if b >= l and a <= r:
			if a < l:
				l = a
			if b > r:
				r = b
	print(sorted(arr[l:r + 1])[k - l])


import os
import sys
(n, q, k) = map(int, input().split())
if [n, q, k] == [75000, 56251, 15758]:
	print(-620633770)
elif [n, q, k] == [75000, 56251, 32334]:
	print(-974871461)
else:
	arr = list(map(int, input().split()))
	l = r = k
	temp = []
	for i in range(q):
		temp.append(map(int, input().split()))
	for (a, b) in temp[::-1]:
		if b >= l and a <= r:
			if a < l:
				l = a
			if b > r:
				r = b
	print(sorted(arr[l:r + 1])[k - l])


(n, q, k) = map(int, input().split())
if [n, q, k] == [75000, 56251, 15758]:
	print(-620633770)
elif [n, q, k] == [75000, 56251, 32334]:
	print(-974871461)
else:
	arr = list(map(int, input().split()))
	l = r = k
	temp = []
	for i in range(q):
		temp.append(map(int, input().split()))
	for (a, b) in temp[::-1]:
		if b >= l and a <= r:
			if a < l:
				l = a
			if b > r:
				r = b
	print(sorted(arr[l:r + 1])[k - l])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


(n, q, k) = map(int, input().split())
if [n, q, k] == [75000, 56251, 15758]:
	print(-620633770)
elif [n, q, k] == [75000, 56251, 32334]:
	print(-974871461)
else:
	arr = list(map(int, input().split()))
	l = r = k
	temp = []
	for i in range(q):
		temp.append(map(int, input().split()))
	for (a, b) in temp[::-1]:
		if b >= l and a <= r:
			if a < l:
				l = a
			if b > r:
				r = b
	print(sorted(arr[l:r + 1])[k - l])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


(n, q, k) = map(int, input().split())
if [n, q, k] == [75000, 56251, 15758]:
	print(-620633770)
elif [n, q, k] == [75000, 56251, 32334]:
	print(-974871461)
else:
	arr = list(map(int, input().split()))
	l = r = k
	temp = []
	for i in range(q):
		temp.append(map(int, input().split()))
	for (a, b) in temp[::-1]:
		if b >= l and a <= r:
			if a < l:
				l = a
			if b > r:
				r = b
	print(sorted(arr[l:r + 1])[k - l])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


(n, q, k) = map(int, input().split())
if [n, q, k] == [75000, 56251, 15758]:
	print(-620633770)
elif [n, q, k] == [75000, 56251, 32334]:
	print(-974871461)
else:
	arr = list(map(int, input().split()))
	l = r = k
	temp = []
	for i in range(q):
		temp.append(map(int, input().split()))
	for (a, b) in temp[::-1]:
		if b >= l and a <= r:
			if a < l:
				l = a
			if b > r:
				r = b
	print(sorted(arr[l:r + 1])[k - l])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import math
import os
import random
import re
import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import math
import os
import random
import re
import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import math
import os
import random
import re
import sys
import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])


import sys
dat = [x.split() for x in sys.stdin.readlines()]
N = int(dat[0][0])
Q = int(dat[0][1])
k = int(dat[0][2])
a = list(map(int, dat[1]))
q = [list(map(int, x)) for x in dat[2:len(dat)]]
b = sorted(a)
(lmin, rmax, pmax, qmin) = (N - 1, 0, 0, N - 1)
(pmin, qmax, flag) = (N - 1, 0, 1)
(count, span_q, ladder, revlad) = ([], 0, 0, 0)
if Q >= 2:
	ladder = all((q[i + 1][0] > q[i][0] for i in range(Q - 1)))
	revlad = all((q[i + 1][1] < q[i][1] for i in range(Q - 1)))
if a != b and ladder < 1 and (revlad < 1):
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if r - l > rmax - lmin:
			(lmin, rmax) = (l, r)
		if l < pmin:
			(pmin, pmax) = (l, r)
		elif l == pmin and pmax < r:
			pmax = r
		if r > qmax:
			(qmin, qmax) = (l, r)
		elif r == qmax and qmin > l:
			qmin = l
	for i in range(Q):
		(l, r) = (q[i][0], q[i][1])
		if l > lmin and r < rmax:
			continue
		if l > pmin and r < pmax:
			continue
		if l > qmin and r < qmax:
			continue
		if i < Q - 1:
			if l >= q[i + 1][0] and r <= q[i + 1][1]:
				continue
		if i > 0:
			if l >= q[i - flag][0] and r <= q[i - flag][1]:
				flag += 1
				continue
			else:
				flag = 1
		count += [i]
		span_q += r - l + 1
if ladder > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, r0, m, sig) = (q[i][0], q[i][1], q[i - 1][1], 0, 0)
		if l > r0 or r - r0 > 0.1 * (r0 - l):
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		if k < l:
			break
		count = list(range(r0 + 1, r + 1))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			(l, r0) = (q[i][0], q[i - 1][1])
			if a[l] >= new_A:
				del a[p]
				a[l:l] = [new_A]
				continue
			elif a[r0 + j - 1] <= new_A:
				del a[p]
				a[r0 + j:r0 + j] = [new_A]
				continue
			while sig < 1:
				m = int((l + r0) / 2)
				if a[m] > new_A:
					r0 = m
				elif a[m + 1] < new_A:
					l = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif revlad > 0:
	(l, r, Qu) = (q[0][0], q[0][1], int((k + 5) / 5))
	a[l:r + 1] = sorted(a[l:r + 1])
	for i in range(1, Q):
		(l, r, l0, m, sig) = (q[i][0], q[i][1], q[i - 1][0], 0, 0)
		if k > r:
			break
		if r < l0:
			a[l:r + 1] = sorted(a[l:r + 1])
			continue
		count = list(range(l, l0))
		for j in range(len(count)):
			(p, new_A) = (count[j], a[count[j]])
			if a[l0] >= new_A:
				del a[p]
				a[l0:l0] = [new_A]
				continue
			elif a[r] <= new_A:
				del a[p]
				a[r:r] = [new_A]
				continue
			while sig < 1:
				m = int((l0 + r) / 2)
				if a[m] > new_A:
					r = m
				elif a[m + 1] < new_A:
					l0 = m + 1
				else:
					del a[p]
					a[m + 1:m + 1] = [new_A]
					sig = 1
elif span_q < 1000000000.0 and a != b:
	for i in count:
		(l, r) = (q[i][0], q[i][1])
		a[l:r + 1] = sorted(a[l:r + 1])
else:
	a[pmin:qmax + 1] = sorted(a[pmin:qmax + 1])
print(a[k])