stack
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <stack>
using namespace std;
const int N = 1000;
int n;
int target[N+2];
bool read_target()
{
scanf("%d", &target[0]);
if (target[0])
{
for (int i = 1; i < n; i++)
scanf("%d", &target[i]);
return true;
}
return false;
}
bool _check()
{
int index = 0;
int train = 0;
stack<int>s;
while (++train <= n)
{
s.push(train);
while (!s.empty() && s.top() == target[index])
{
s.pop();
index++;
}
}
return (index == n);
}
int main()
{
while (scanf("%d", &n) == 1 && n)
{
while (read_target())
printf("%s\n", _check() ? "Yes" : "No");
putchar('\n');
}
return 0;
}