#include<bits/stdc++.h>
using namespace std;
int main(){
	int n, q, k;
	cin>>n>>q>>k;
	int p[n];
	for (int i = 0; i < n; i++)
		cin>>p[i];
	vector <pair <int, int>> a(n);
	for (int i = 0; i < n; i++){
		a[i].first = 1;
		a[i].second = i + 1;
	}
	for (int qi = 0; qi < q; qi++){
		int l, r;
		cin>>l>>r;
		int i = l, j = 0;
		while (i <= r){
			a[i - 1].first = p[j];
			i++;
			j++;
		}
		sort(a.begin() + l, a.begin() + r);
		for (int i = 0; i < n; i++)
			cout<<a[i].second<<" ";
		cout<<'\n';
	}
	cout<<a[k - 1].second;
	return 0;
}