#include<iostream>
#include<vector>
using namespace std;
extern void init (std::vector <int> A);
extern std::vector <int> queries (std::vector <std::pair <int, int>> S);
extern void update (int I, int V);
int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,q;
    cin >> n >> q ;
    bool f;
    cin >> f ;
    vector <int> a(n);
    for (int i=0; i<n; i++) {
        cin >> a[i] ;
    }
    init(a);
    vector <pair <int, int>> s;
    for (int i=0; i<q; i++) {
        int t,x,y;
        cin >> t >> x >> y ;
        if (t==1) {
            if (f==true) s.push_back({x, y});
            else {
                auto anss=queries({{x, y}});
                for (auto ans : anss) {
                    cout << ans << " ";
                }
                cout << "\n";
            }
        }
        else if (t==2) update(x,y);
    }
    if (f==true) {
        auto anss=queries(s);
        for (auto ans : anss) {
            cout << ans << " ";
        }
    }
    return 0;
}
