#include <bits/stdc++.h>
#define MAX 100000
using namespace std;
ifstream fin("arbint.in");
ofstream fout("arbint.out");
int arb[4*MAX], lazy[8*MAX], v[MAX];
void construieste(int nod, int st, int dr) {
if (st==dr) arb[nod]=v[st];
else {
int mij=(st+dr)/2;
construieste(2*nod, st, mij);
construieste(2*nod+1, mij+1, dr);
arb[nod]=max(arb[2*nod], arb[2*nod+1]);
}
}
void coborare(int nod, int st, int dr) {
if (lazy[nod]!=0) {
arb[nod]=max(lazy[nod], arb[nod]);
if (2*nod+1<4*MAX) {
lazy[2*nod]=max(lazy[nod], lazy[2*nod]);
lazy[2*nod+1]=max(lazy[nod], lazy[2*nod+1]);
}
lazy[nod]=0;
}
}
void update(int nod, int st, int dr, int a, int b, int x) {
// if (a<=st && dr<=b) {
// lazy[nod]=max(lazy[nod], x);
// coborare(nod, st, dr);
// return ;
// }
if (st==dr) {
arb[nod]=x;
return ;
}
int mij=(st+dr)/2;
if (a<=mij) update(2*nod, st, mij, a, b, x);
if (mij+1<=b) update(2*nod+1, mij+1, dr, a, b, x);
coborare(2*nod, st, mij);
coborare(2*nod+1, mij+1, dr);
arb[nod]=max(arb[2*nod], arb[2*nod+1]);
}
int intrebare(int nod, int st, int dr, int a, int b) {
if (a<=st && dr<=b) return arb[nod];
int mij=(st+dr)/2, maxi=0;
if (a<=mij) maxi=max(maxi, intrebare(2*nod, st, mij, a, b));
if (mij+1<=b) maxi=max(maxi, intrebare(2*nod+1, mij+1, dr, a, b));
return maxi;
}
int main()
{
int n, m, q, a, b;
fin>>n>>m;
for (int i=1; i<=n; i++) {
fin>>v[i];
}
construieste(1, 1, n);
for (int i=1; i<=m; i++) {
fin>>q>>a>>b;
if (q==0) fout<<intrebare(1, 1, n, a, b)<<'\n';
else update(1, 1, n, a, a, b);
}
return 0;
}