#include <bits/stdc++.h>

using namespace std;

int main()
{
  int N;
  scanf("%d", &N);

  multiset< int > sets;
  sets.insert(0);
  for(int i = 0; i < N; i++) {
    int depth;
    scanf("%d", &depth);
    auto p = sets.upper_bound(depth);
    if(p == sets.begin()) {
      puts("No");
    } else {
      int q = *--p;
      sets.erase(p);
      puts("Yes");
      for(int j = q + 1; j <= depth && sets.size() <= N; j++) {
        if(sets.size() == N && *--sets.end() > j) sets.erase(--sets.end());
        sets.insert(j);
      }
    }
  }
}
### Prompt

Your task is to create a CPP solution to the following problem:

Example

Input

6
2
3
1
1
4
2


Output

Yes
Yes
Yes
No
Yes
No

### Response

```cpp
#include <bits/stdc++.h>

using namespace std;

int main()
{
  int N;
  scanf("%d", &N);

  multiset< int > sets;
  sets.insert(0);
  for(int i = 0; i < N; i++) {
    int depth;
    scanf("%d", &depth);
    auto p = sets.upper_bound(depth);
    if(p == sets.begin()) {
      puts("No");
    } else {
      int q = *--p;
      sets.erase(p);
      puts("Yes");
      for(int j = q + 1; j <= depth && sets.size() <= N; j++) {
        if(sets.size() == N && *--sets.end() > j) sets.erase(--sets.end());
        sets.insert(j);
      }
    }
  }
}
```