#include<bits/stdc++.h>
using namespace std;
int n,a[200005][2];
int main(){
ios::sync_with_stdio(false);
cin>>n;
for(int i = 0;i<n;i++){
cin>>a[i][0];
}
int i = 0,s = 0,x = a[0][0];
while(s!=n){
if(a[i][0] == x&&!a[i][1]){
x^=1;
s++;
a[i][1] = 1;
cout<<i+1<<' ';
}
if(i == n-1){
cout<<'\n';
int t;
for(int j = 0;j<n;j++){
if(!a[j][1]){
t = j;
break;
}
}
i = t;
x = a[t][0];
}else{
i++;
}
}
return 0;
}