#include <iostream>
#include <vector>
using namespace std;
class SegmentTree {
public:
SegmentTree(const vector<int>& data) {
n = data.size();
tree.resize(4 * n);
build(data, 0, 0, n - 1);
}
void update(int idx, int value) {
update(idx, value, 0, 0, n - 1);
}
bool range_query(int l, int r) {
return query(l, r, 0, 0, n - 1).sorted;
}
private:
struct Node {
int min_val;
int max_val;
bool sorted;
};
vector<Node> tree;
int n;
void build(const vector<int>& data, int node, int start, int end) {
if (start == end) {
tree[node] = {data[start], data[start], true};
} else {
int mid = (start + end) / 2;
build(data, 2 * node + 1, start, mid);
build(data, 2 * node + 2, mid + 1, end);
tree[node] = merge(tree[2 * node + 1], tree[2 * node + 2]);
}
}
void update(int idx, int value, int node, int start, int end) {
if (start == end) {
tree[node] = {value, value, true};
} else {
int mid = (start + end) / 2;
if (start <= idx && idx <= mid) {
update(idx, value, 2 * node + 1, start, mid);
} else {
update(idx, value, 2 * node + 2, mid + 1, end);
}
tree[node] = merge(tree[2 * node + 1], tree[2 * node + 2]);
}
}
Node query(int l, int r, int node, int start, int end) {
if (r < start || end < l) {
return {INT_MAX, INT_MIN, true};
}
if (l <= start && end <= r) {
return tree[node];
}
int mid = (start + end) / 2;
Node left_result = query(l, r, 2 * node + 1, start, mid);
Node right_result = query(l, r, 2 * node + 2, mid + 1, end);
return merge(left_result, right_result);
}
Node merge(const Node& left, const Node& right) {
if (left.sorted && right.sorted && left.max_val <= right.min_val) {
return {left.min_val, right.max_val, true};
} else {
return {min(left.min_val, right.min_val), max(left.max_val, right.max_val), false};
}
}
};
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N, Q;
cin >> N >> Q;
vector<int> array(N);
for (int i = 0; i < N; ++i) {
cin >> array[i];
}
SegmentTree st(array);
while (Q--) {
int type;
cin >> type;
if (type == 1) {
int i, x;
cin >> i >> x;
st.update(i - 1, x);
} else if (type == 2) {
int l, r;
cin >> l >> r;
if (st.range_query(l - 1, r - 1)) {
cout << "YES\n";
} else {
cout << "NO\n";
}
}
}
return 0;
}