水题.
#include <iostream>
#include <cstdio>
#include <memory.h>
using namespace std;
const int maxn = 100010;
int n;
int p1[maxn], p2[maxn];
void readInt(int &x){
x = 0;
char ch;
ch = getchar();
while(!(ch >= '0' && ch <= '9'))ch = getchar();
while(ch >= '0' && ch <= '9'){
x = x * 10 + (ch - '0');
ch = getchar();
}
}
int main(){
while(scanf("%d", &n) && n){
for(int i = 1; i <= n; ++i){
readInt(p1[i]);
}
for(int i = 1; i <= n; ++i){
p2[p1[i]] = i;
}
if(memcmp(p1, p2, sizeof(int) * (n + 1)) == 0){
printf("ambiguous\n");
}else{
printf("not ambiguous\n");
}
}
return 0;
}