#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
struct SegTreeNode {
int Max, maxl, maxr;
} segtree[N<<2];
int n, m, a[N];
void pushup(int l, int r, int tr) {
int m = l + r >> 1;
if (a[m] >= a[m + 1]) {
segtree[tr].Max = max(segtree[tr<<1].Max, segtree[tr<<1|1].Max);
segtree[tr].maxl = segtree[tr<<1].maxl;
segtree[tr].maxr = segtree[tr<<1|1].maxr;
} else {
segtree[tr].Max = max(max(segtree[tr<<1].Max, segtree[tr<<1|1].Max), segtree[tr<<1].maxr+segtree[tr<<1|1].maxl);
segtree[tr].maxl = segtree[tr<<1].maxl == (m - l + 1) ? (m-l+1) + segtree[tr<<1|1].maxl : segtree[tr<<1].maxl;
segtree[tr].maxr = segtree[tr<<1|1].maxr == (r - m) ? (r-m) + segtree[tr<<1].maxr : segtree[tr<<1|1].maxr;
}
}
void build(int l, int r, int tr) {
if (l == r) {
segtree[tr].Max = segtree[tr].maxl = segtree[tr].maxr = 1;
return;
}
int m = l + r >> 1;
build(l, m, tr << 1);
build(m + 1, r, tr << 1 | 1);
pushup(l, r, tr);
}
void update(int L, int C, int l, int r, int tr) {
if (l == r) {
a[l] = C;
return;
}
int m = l + r >> 1;
if (L <= m) update(L, C, l, m, tr << 1);
else update(L, C, m + 1, r, tr << 1 | 1);
pushup(l, r, tr);
}
int query(int L, int R, int l, int r, int tr) {
if (L <= l && r <= R) return segtree[tr].Max;
if (L > r || R < l) return 0;
int m = l + r >> 1, mmax = 0;
if (L <= m && R >= m) {
mmax += segtree[tr << 1].maxr >= (m - L + 1) ? (m - L + 1) : segtree[tr << 1].maxr;
mmax += segtree[tr << 1 | 1].maxl >= (R - m) ? (R - m) : segtree[tr << 1 | 1].maxl;
}
return max(mmax, max(query(L, R, l, m, tr << 1), query(L, R, m + 1, r, tr << 1 | 1)));
}
int main() {
int T;
scanf("%d", &T);
while (T--) {
scanf("%d %d", &n, &m);
for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
build(0, n - 1, 1);
while (m--) {
char opt[5];
int a, b;
scanf("%s %d %d", opt, &a, &b);
if (opt[0] == 'Q') cout << query(a, b, 0, n - 1, 1) << endl;
else update(a, b, 0, n - 1, 1);
}
}
return 0;
}