#include <cstdio>
#include <fstream>
#include <stdlib.h>
using namespace std;
const int NMAX = 4*100005;
#define max(x, y) x>y?x:y
int arb[NMAX], a, b;
void update(int poz, int l, int r)
{
if(l==r) arb[poz]=b;
else
{
int m = (l+r) >> 1;
if(a <= m)
update(2*poz, l, m);
else
update(2*poz+1, m+1, r);
arb[poz] = max(arb [ 2*poz ], arb[ 2*poz+1 ]);
}
}
int query(int poz, int l, int r)
{
if(a <= l && r <= b) return arb[poz];
int m =(l+r)>>1, max1=0, max2=0;
if(a <= m) max1 = query(2*poz, l, m);
if(m < b) max2 = query(2*poz+1, m+1, r);
return max(max1, max2);
}
int main()
{
int n, m, i, op;
ifstream f("arbint.in");
ofstream g("arbint.out");
//freopen("arbint.in", "r", stdin);
//freopen("arbint.out", "w", stdout);
//scanf("%d%d", &n, &m);
f >> n >> m;
for(a = 1; a <= n; a++)
{
//scanf("%d", &b);
f >> b;
update(1, 1, n);
}
for(i = 0; i < m; i++)
{
//scanf("%d%d%d", &op, &a, &b);
f >> op >> a >> b;
if(op==0) g<< query(1, 1, n) <<"\n";
else update(1, 1, n);
}
return 0;
}