#include <bits/stdc++.h>
using namespace std;
const int N= 100005;
struct node{
int maxPrefix;
int maxSuffix;
int ans;
long left;
long right;
void assignLeaf( long val ){
maxPrefix= maxSuffix= ans= 1;
left= right= val;
}
void merge( node a, node b ){
this->left= a.left;
this->right= b.right;
this->maxPrefix= a.maxPrefix;
this->maxSuffix= b.maxSuffix;
if( a.right < b.left ){
this->ans= max( maxSuffix+maxPrefix, max( maxPrefix, maxSuffix ) );
}else{
this->ans= max( a.ans, b.ans );
}
}
};
node st[4*N];
long a[N];
void build( int id, int l, int r ){
if( l== r ){
st[id].assignLeaf( a[l] );
return ;
}
int mid= l + ( r-l )/2;
build( 2*id, l, mid );
build( 2*id+1, mid+1, r );
st[id].merge( st[id*2], st[id*2+1] );
}
int query( int id, int l, int r, int x, int y ){
if( l > r || y < l || x > r )
return 0;
if( x<= l && y >= r )
return st[id].ans;
int mid= l + ( r-l )/2;
int a= query( 2*id, l, mid, x, y );
int b= query( 2*id+1, mid+1, r , x, y );
return max( a, b );
}
void update( int id, int l, int r, int x , long val ){
if( l== r ){
a[x]= val;
st[id].assignLeaf( val );
return ;
}
int mid= l + ( r-l )/2;
if( mid >= l && x <= mid )
update( 2*id, l, mid, x, val );
else
update( 2*id+1, mid+1, r, x, val );
st[id].merge( st[id*2], st[id*2+1] );
}
int main(){
int n, x, y, t, p, q;
cin >> t;
while( t-- ){
cin >> n >> q;
for( int i= 0; i< n; ++i )
cin >> a[i];
build( 1, 0, n-1 );
while( q-- ){
cin >> p >> x >> y;
if( p ){
update( 1, 0, n-1, x, y );
}else{
cout << query( 1, 0, n-1, x, y );
}
}
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpjb25zdCBpbnQgTj0gMTAwMDA1OwoKc3RydWN0IG5vZGV7CiAgICBpbnQgbWF4UHJlZml4OwogICAgaW50IG1heFN1ZmZpeDsKICAgIGludCBhbnM7CiAgICBsb25nIGxlZnQ7CiAgICBsb25nIHJpZ2h0OwoKICAgIHZvaWQgYXNzaWduTGVhZiggbG9uZyB2YWwgKXsKICAgICAgICBtYXhQcmVmaXg9IG1heFN1ZmZpeD0gYW5zPSAxOwogICAgICAgIGxlZnQ9IHJpZ2h0PSB2YWw7CiAgICB9CgogICAgdm9pZCBtZXJnZSggbm9kZSBhLCBub2RlIGIgKXsKCiAgICAgICAgdGhpcy0+bGVmdD0gYS5sZWZ0OwogICAgICAgIHRoaXMtPnJpZ2h0PSBiLnJpZ2h0OwogICAgICAgIHRoaXMtPm1heFByZWZpeD0gYS5tYXhQcmVmaXg7CiAgICAgICAgdGhpcy0+bWF4U3VmZml4PSBiLm1heFN1ZmZpeDsKCiAgICAgICAgaWYoIGEucmlnaHQgPCBiLmxlZnQgKXsKICAgICAgICAgICAgdGhpcy0+YW5zPSBtYXgoIG1heFN1ZmZpeCttYXhQcmVmaXgsIG1heCggbWF4UHJlZml4LCBtYXhTdWZmaXggKSApOwogICAgICAgIH1lbHNlewogICAgICAgICAgICB0aGlzLT5hbnM9IG1heCggYS5hbnMsIGIuYW5zICk7CiAgICAgICAgfQoKICAgIH0KfTsKCm5vZGUgc3RbNCpOXTsKbG9uZyBhW05dOwoKdm9pZCBidWlsZCggaW50IGlkLCBpbnQgbCwgaW50IHIgKXsKCiAgICBpZiggbD09IHIgKXsKICAgICAgICBzdFtpZF0uYXNzaWduTGVhZiggYVtsXSApOwogICAgICAgIHJldHVybiA7CiAgICB9CgogICAgaW50IG1pZD0gbCArICggci1sICkvMjsKCiAgICBidWlsZCggMippZCwgbCwgbWlkICk7CiAgICBidWlsZCggMippZCsxLCBtaWQrMSwgciApOwoKICAgIHN0W2lkXS5tZXJnZSggc3RbaWQqMl0sIHN0W2lkKjIrMV0gKTsKCn0KCmludCBxdWVyeSggaW50IGlkLCBpbnQgbCwgaW50IHIsIGludCB4LCBpbnQgeSApewoKICAgIGlmKCBsID4gciB8fCB5IDwgbCB8fCB4ID4gciApCiAgICAgICAgcmV0dXJuIDA7CgogICAgaWYoIHg8PSBsICYmIHkgPj0gciApCiAgICAgICAgcmV0dXJuIHN0W2lkXS5hbnM7CgogICAgaW50IG1pZD0gbCArICggci1sICkvMjsKCiAgICBpbnQgYT0gcXVlcnkoIDIqaWQsIGwsIG1pZCwgeCwgeSApOwogICAgaW50IGI9IHF1ZXJ5KCAyKmlkKzEsIG1pZCsxLCByICwgeCwgeSApOwoKICAgIHJldHVybiBtYXgoIGEsIGIgKTsKfQoKdm9pZCB1cGRhdGUoIGludCBpZCwgaW50IGwsIGludCByLCBpbnQgeCAsIGxvbmcgdmFsICl7CgogICAgaWYoIGw9PSByICl7CiAgICAgICAgYVt4XT0gdmFsOwogICAgICAgIHN0W2lkXS5hc3NpZ25MZWFmKCB2YWwgKTsKICAgICAgICByZXR1cm4gOwogICAgfQoKICAgIGludCBtaWQ9IGwgKyAoIHItbCApLzI7CgogICAgaWYoIG1pZCA+PSBsICYmIHggPD0gbWlkICkKICAgICAgICB1cGRhdGUoIDIqaWQsIGwsIG1pZCwgeCwgdmFsICk7CiAgICBlbHNlCiAgICAgICAgdXBkYXRlKCAyKmlkKzEsIG1pZCsxLCByLCB4LCB2YWwgKTsKCiAgICBzdFtpZF0ubWVyZ2UoIHN0W2lkKjJdLCBzdFtpZCoyKzFdICk7Cgp9CgppbnQgbWFpbigpewoKICAgIGludCBuLCB4LCB5LCB0LCBwLCBxOwoKICAgIGNpbiA+PiB0OwoKICAgIHdoaWxlKCB0LS0gKXsKCiAgICAgICAgY2luID4+IG4gPj4gcTsKCiAgICAgICAgZm9yKCBpbnQgaT0gMDsgaTwgbjsgKytpICkKICAgICAgICAgICAgY2luID4+IGFbaV07CgogICAgICAgIGJ1aWxkKCAxLCAwLCBuLTEgKTsKCiAgICAgICAgd2hpbGUoIHEtLSApewoKICAgICAgICAgICAgY2luID4+IHAgPj4geCA+PiB5OwoKICAgICAgICAgICAgaWYoIHAgKXsKICAgICAgICAgICAgICAgIHVwZGF0ZSggMSwgMCwgbi0xLCB4LCB5ICk7CiAgICAgICAgICAgIH1lbHNlewogICAgICAgICAgICAgICAgY291dCA8PCBxdWVyeSggMSwgMCwgbi0xLCB4LCB5ICk7CiAgICAgICAgICAgIH0KCiAgICAgICAgfQoKCgogICAgfQoKfQo=