#include #include using namespace std; using ll=long long; using ull=unsigned long long; using pll=pair; using tll=tuple; using ld=long double; const ll INF=(1ll<<60); #define rep(i,n) for (ll i=0;i<(ll)(n);i++) #define replr(i,l,r) for (ll i=(ll)(l);i<(ll)(r);i++) #define all(v) v.begin(),v.end() #define len(v) ((ll)v.size()) template inline bool chmin(T &a,T b){ if(a>b){ a=b; return true; } return false; } template inline bool chmax(T &a,T b){ if(a> n >> q; set st; __gnu_cxx::rope p(n,0); rep(i,n){ ll a; cin >> a; p.erase(i,1); p.insert(i,a); st.insert(i); } while(q--){ ll t; cin >> t; if(t==1){ ll k,x; cin >> k >> x; k--; p.erase(k,1); p.insert(k,x); st.insert(k); } if(t==2){ vector v; for(auto i:st) v.push_back(p[i]); ll d=0; for(auto i:st){ p.erase(i-d,1); d++; } for(auto i:v){ ll ok=-1,ng=len(p); while(1> k; k--; cout << p[k] << '\n'; } } }