#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=100010;
int n,m,q,a[N];
bool cmp (int x,int y) {
return x > y;
}
int main () {
freopen("heoi2016_sort.in","r",stdin);
freopen("heoi2016_sort.out","w",stdout);
ios::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
cin >> n >> m;
for (int i=1;i<=n;i++) cin >> a[i];
while (m--) {
int op,l,r;
cin >> op >> l >> r;
if (op==0) sort(a+l+1,a+r+1);
else sort(a+l+1,a+r+1,cmp);
}
cin >> q;
cout << a[q] <<endl;
return 0;
}