#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <fstream>
#include <utility>
using namespace std;
typedef long long ll;
typedef pair<int, int> Pii;
#define
const int INF = 0x7fffffff;
const int MOD = 1e4;
const int MAXN = 1e5 + 2;
struct node {
int left;
int right;
int mx;
int lm;
int rm;
}tree[MAXN << 2];
int n, m;
int a[MAXN];
void PushUp(int rt) {
tree[rt].lm = tree[rt << 1].lm;
tree[rt].rm = tree[rt << 1 | 1].rm;
tree[rt].mx = max(tree[rt << 1].mx, tree[rt << 1 | 1].mx);
int mid = (tree[rt].left + tree[rt].right) >> 1;
if (a[mid] < a[mid + 1])
{
if (tree[rt << 1].lm == mid - tree[rt].left + 1) tree[rt].lm += tree[rt << 1 | 1].lm;
if (tree[rt << 1 | 1].rm == tree[rt].right - mid) tree[rt].rm += tree[rt << 1].rm;
tree[rt].mx = max(tree[rt].mx, tree[rt << 1].rm + tree[rt << 1 | 1].lm);
}
}
void build(int rt, int l, int r) {
tree[rt].left = l;
tree[rt].right = r;
if (l == r) {
tree[rt].mx = tree[rt].lm = tree[rt].rm = 1;
return;
}
int mid = (l + r) >> 1;
build(rt << 1, l, mid);
build(rt << 1 | 1, mid + 1, r);
PushUp(rt);
}
void updata(int rt, int val, int p) {
if (tree[rt].left == tree[rt].right) {
a[p] = val;
return;
}
int mid = (tree[rt].left + tree[rt].right) >> 1;
if (p <= mid) updata(rt << 1, val, p);
else updata(rt << 1 | 1, val, p);
PushUp(rt);
}
int Query(int rt, int l, int r) {
if (l <= tree[rt].left && tree[rt].right <= r) {
return tree[rt].mx;
}
int mid = (tree[rt].left + tree[rt].right) >> 1;
int s = 0;
if (l <= mid) s = max(s, Query(rt << 1, l, r));
if (r > mid) s = max(s, Query(rt << 1 | 1, l, r));
if (a[mid] < a[mid + 1])
s = max(s, min(tree[rt << 1].rm, mid - l + 1) + min(tree[rt << 1 | 1].lm, r - mid));
return s;
}
int main() {
ios;
int T;
cin >> T;
while (T--) {
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> a[i];
build(1, 1, n);
while (m--) {
char str[3];
int x, y;
cin >> str >> x >> y;
if (str[0] == 'Q')
cout << Query(1, x + 1, y + 1) << endl;
else
updata(1, y, x + 1);
}
}
return 0;
}