as im submitting the code below its showing a wrong answer for this problem here
/*created by raghavyadavm*/
#include<stdio.h>
int main()
{
int n,i,j,flag=0;
unsigned int a[100001],b[100001];
do
{
scanf("%d",&n);
flag=0;
if(n)
{
for(i=1;i<=n;i++) //reading and storing
{
scanf("%d",&a[i]);
b[a[i]]=i;
}
for(i=1;i<=n;i++)
{
if(a[i]==b[i])
flag++; //comparing
}
if(flag==n)
printf("ambiguous\n");
else
printf("unambiguous\n");
}
}while(n);
return 0;
}