#include
#include
using namespace std;
int main() {
int T;
cin >> T; //输入数据组数
while (T--) { //循环处理每组数据
int n;
cin >> n; //输入火车数
stack station; //定义一个栈来模拟火车站
int next_in = 1, next_out = 1; //next_in表示下一辆要驶入的火车编号,next_out表示下一辆要驶出的火车编号
for (int i = 1; i <= n; i++) {
int x;
cin >> x; //输入火车驶入休息区S的顺序
while (next_in <= x) { //将编号从next_in到x的火车依次驶入火车站
station.push(next_in);
next_in++;
}
if (station.top() != x) { //如果栈顶不是编号为x的火车,则无法满足驶入顺序
cout << "No" << endl;
goto end_of_loop; //跳出循环
}
station.pop(); //将编号为x的火车驶出火车站
}
while (!station.empty()) { //将剩余的火车依次驶出火车站
int x = station.top();
station.pop();
if (x != next_out) { //如果编号不是next_out,则无法满足驶出顺序
cout << "No" << endl;
goto end_of_loop; //跳出循环
}
next_out++;
}
cout << "Yes" << endl; //驶入和驶出顺序可以被满足
end_of_loop:;
}
return 0;
}