import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner obj1=new Scanner(System.in);
Scanner obj2=new Scanner(System.in);
//int k=obj1.nextInt();
String answer[]=new String[100];
int j=0;
while(true)
{
int m=obj1.nextInt();
if(m==0)
break;
String n=obj2.nextLine();
String s[]=n.split(" ");
int a[]=new int[m];
for(int i=0;i<m;i++){
a[i]=Integer.parseInt(s[i]);
}
for(int i=0;i<m;i++)
{
// System.out.println(a[i]);
int temp=a[i];
if(a[temp-1]==(i+1))
answer[j]=“ambiguous”;
else
answer[j]=“not ambiguous”;
}
++j;
}
for(int k=0;k<j;k++)
System.out.println(answer[k]);
}
}