import java.io.*;
import java.util.StringTokenizer;
/**
* Created by Aetheryon on 01.01.2016.
*/
public class Main{
public static int n,q,leaf,type,a,b,nr = 0;
public static int MAX_SIZE = 100013;
public static String URL_INPUT = "arbint.in";
public static String URL_OUTPUT = "arbint.out";
public static String line;
public static StringTokenizer st;
public static int[] el ;
public static BufferedReader in;
public static PrintStream out;
public static void main(String[] args) throws IOException {
in = new BufferedReader(new FileReader(URL_INPUT));
out = new PrintStream(URL_OUTPUT);
el = new int[MAX_SIZE];
el = parseLine();
n = el[0]; q = el[1];
// construct a segment tree
SegmentTree tree = new SegmentTree();
el = parseLine();
for (int i=1;i<=n;++i)
tree.updateSegment(1,1,n,i,i,el[i-1]);
for (;q>=1;--q){
el = parseLine();
type = el[0]; a = el[1]; b = el[2];
if (type==0) out.println(tree.getMax(1, 1, n, a, b));
else tree.updateSegment(1,1,n,a,a,b);
}
}
public static class SegmentTree {
private int[] treeNode;
// constructor
SegmentTree() {
treeNode = new int[4*MAX_SIZE];
}
protected void updateSegment(int node, int x, int y, int left, int right, int value) {
if (x > right || y < left || x > y) return;
if (x >= left && y <= right) {
treeNode[node] = value;
return;
}
int middle = (x+y)/2;
updateSegment(node * 2, x, middle, left, right, value);
updateSegment(node * 2 + 1, middle + 1, y, left, right, value);
treeNode[node] = Math.max(treeNode[node*2], treeNode[node*2+1]);
}
protected int getMax(int node, int x, int y, int left, int right) {
if (x > right || y < left || x > y) return 0;
if (x >= left && y <= right) return treeNode[node];
int middle = (x+y)/2;
return Math.max(getMax(node * 2, x, middle, left, right), getMax(node * 2 + 1, middle + 1, y, left, right));
}
}
public static int[] parseLine(){
String line="";
int[] arr = new int[MAX_SIZE];
int nbr = 0, cnt = 0;
try {
line =in.readLine();
} catch(IOException e){}
for (int i=0;i<line.length();++i) {
if (line.charAt(i) >= '0' && line.charAt(i) <= '9')
nbr = nbr * 10 + line.charAt(i) - '0';
if ((!(line.charAt(i) >= '0' && line.charAt(i) <= '9')) || (i == line.length() - 1) ){
arr[cnt] = nbr;
++cnt;
nbr = 0;
}
}
return arr;
}
}