#include <iostream>
#include<vector>
#include<string>
#include<math.h>
#include<set>
#include<map>
#include<algorithm>
/***** S. M. Sabiul Hajjaj Sabit *****/
using namespace std;
template <typename T>long long int power(T a, T b)
{
long long int pow=1;
for(int i=0; i<b; i++)
{
pow *= a;
}
return pow;
}
///*********Write Code From Here*********///
int a[100005]= {0};
int main()
{
int n;
cin>>n;
int req=n;
set<int>s;
for(int i=1; i<=n; i++)
{
int x;
cin>>x;
a[x]=1;
while(a[req]==1)
{
cout<<req<<" ";
req--;
}
cout<<endl;
}
return 0;
}
Add your comment