#include<bits/stdc++.h>
using namespace std;
int n,q,a[105][105];
void dfs(int cs,int x){
if (cs>n){
cout<<"CIKLUS"<<endl;
return;
}
int flag=0;
for (int i=1;i<=n;i++){
if (a[x][i]){
flag=1;
dfs(cs+1,i);
break;
}
}
if (flag==0){
cout<<x<<endl;
}
}
int main(){
freopen("marbles.in","r",stdin);
freopen("marbles.out","w",stdout);
cin>>n;
for (int i=1;i<=n;i++){
int x;
cin>>x;
a[i][x]=1;
}
cin>>q;
for (int i=1;i<=q;i++){
int s,X;
cin>>s>>X;
if (q*n*n>100000000){
cout<<"CIKLUS"<<endl;
continue;
}
if (s==1){
dfs(0,X);
}else{
for (int i=1;i<=n;i++) a[X][i]=0;
}
}
return 0;
}