#include<bits/stdc++.h>
using namespace std;
const int N = 1 * 1e4 + 10;
int n, q, a[N], b[N], x, y, z;
bool cmp(int a, int b)
{
return a < b;
}
void solve()
{
int t;
cin >> t;
if(t == 1)
{
cin >> x >> y;
a[x] = y;
}
else if(t == 2)
{
cin >> x >> y >> z;
for(int i = 1; i <= n; i ++)
{
b[i] = a[i];
}
sort(b + 1, b + n + 1, cmp);
cout << b[z] << endl;
}
}
int main()
{
cin >> n;
for(int i = 1; i <= n; i ++)
{
cin >> a[i];
}
cin >> q;
while(q --)
{
solve();
}
return 0;
}