#include<stdio.h>

#define size 100000

int a[size+1],b[size+1];

int main()

{

int i,j,c;long n;

while(1)

{ c=0;

scanf("%ld",&n);

if (n==0)

return;

```
for (i=1;i<=n;i++)
{
scanf("%d",&a[i]);
}
for (i=1;i<=n;i++)
{
j=a[i];
b[j]=i;
}
for (j=1;j<=n;j++)
{ if (a[j]==b[j])
c++;
else
break;
}
if(c==n)
printf("ambiguous \n");
else
printf("not ambiguous \n");
}
getch();
return 0;
}
```

question in ambiguous permutation in practice problems -> easy