#include<bits/stdc++.h>
using namespace std;
const int N = 200010;
typedef long long LL;
int n;
int a[N];
int st[N],ans;
int main()
{
scanf("%d",&n);
for(int i =1;i<=n;i++)scanf("%d",&a[i]);
int i,j,cnt,first = 1;
while(ans<n)
{
for(i = first;i <= n;i ++)
{
if(!st[i])
{
cnt = a[i];
st[i] = true;
first = i;
ans ++;
printf("%d ",i);
break;
}
}
for( j =i + 1;j <= n;j ++)
{
if(!st[j])
{
if(a[j] != cnt)
{
st[j] = true;
cnt = a[j];
ans++;
printf("%d ",j);
}
}
}
printf("\n");
}
return 0;
}