#include<bits/stdc++.h>
using namespace std;
int main(){
int t,n; cin >> t;
while(t--){
cin >> n;
vector<int> s(n);
bool psble = true;
for(int i=0;i<n;i++) cin >> s[i];
for(int i=1;i<n;i++){
if(s[i-1] > s[i] && s[i-1] - s[i] > 1){
psble = false;
break;
}else if(s[i] < s[i-1]) swap(s[i],s[i-1]);
}
//for(auto i : s) cout << i << " ";
psble ? cout << "YES\n" : cout << "NO\n";
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCl7CglpbnQgdCxuOwljaW4gPj4gdDsKCXdoaWxlKHQtLSl7CgkJY2luID4+IG47CgkJdmVjdG9yPGludD4gcyhuKTsKCQlib29sIHBzYmxlID0gdHJ1ZTsKCQlmb3IoaW50IGk9MDtpPG47aSsrKQljaW4gPj4gc1tpXTsKCQlmb3IoaW50IGk9MTtpPG47aSsrKXsKCQkJaWYoc1tpLTFdID4gc1tpXSAmJiBzW2ktMV0gLSBzW2ldID4gMSl7CgkJCQlwc2JsZSA9IGZhbHNlOwoJCQkJYnJlYWs7CgkJCX1lbHNlIGlmKHNbaV0gPCBzW2ktMV0pCXN3YXAoc1tpXSxzW2ktMV0pOwoJCX0KCQkvL2ZvcihhdXRvIGkgOiBzKQljb3V0IDw8IGkgPDwgIiAiOwoJCXBzYmxlID8gY291dCA8PCAiWUVTXG4iIDogY291dCA8PCAiTk9cbiI7Cgl9CglyZXR1cm4gMDsKfQo=