import java.io.File;
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.Scanner;
public class Main {
static int N, Q, operation, a, b;
static int[] values, sTree;
public static int max(int a, int b) {
return a < b ? b : a;
}
public static void update(int[] sTree, int node, int left, int right, int a, int b, int value) {
if (left == right) {
sTree[node] = value;
} else {
int middle = left + (right - left) / 2;
if (a <= middle) {
update(sTree, 2 * node + 1, left, middle, a, b, value);
}
if (b > middle) {
update(sTree, 2 * node + 2, middle + 1, right, a, b, value);
}
sTree[node] = max(sTree[2 * node + 1], sTree[2 * node + 2]);
}
}
public static int query(int[] sTree, int node, int left, int right, int a, int b) {
if (a <= left && right <= b) {
return sTree[node];
} else {
int middle = left + (right - left) / 2, first = 0, second = 0;
if (a <= middle) {
first = query(sTree, 2 * node + 1, left, middle, a, b);
}
if (middle < b) {
second = query(sTree, 2 * node + 2, middle + 1, right, a, b);
}
return max(first, second);
}
}
public static void main(String[] args) {
try {
File output = new File("arbint.out");
output.createNewFile();
System.setIn(new FileInputStream(new File("arbint.in")));
System.setOut(new PrintStream(output));
Scanner scanner = new Scanner(System.in);
N = scanner.nextInt();
Q = scanner.nextInt();
values = new int[N];
sTree = new int[3 * N];
for (int it = 0; it < N; ++it) {
values[it] = scanner.nextInt();
update(sTree, 0, 0, N - 1, it, it, values[it]);
}
for (int it = 0; it < Q; ++it) {
operation = scanner.nextInt();
a = scanner.nextInt();
b = scanner.nextInt();
switch (operation) {
case 0:
System.out.println(query(sTree, 0, 0, N - 1, a - 1, b - 1));
break;
default:
update(sTree, 0, 0, N - 1, a - 1, a - 1, b);
break;
}
}
if (scanner != null) {
scanner.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}