n = int(input())
a = list(map(int,input().split()))
k = 0
r = 0
sum1 = 0
for i in range(n+1):
if a[i] > 1:
k += 1
else:
k = 0
if k == 2:
r = 1
sum1 += a[i]
if r == 0:
print('perfect')
exit()
r1 = []
r2 = []
num = 0
prev = 0
for i in range(n+1):
was = 0
for k in range(a[i]):
r1.append(prev)
if a[i] > 1 and a[i-1] > 1 and was == 0:
r2.append(prev-1)
was = 1
else:
r2.append(prev)
num += 1
prev = num
print('ambiguous')
print(*r1)
print(*r2)
Back to School | I am Easy |
Teddy and Tweety | Partitioning binary strings |
Special sets | Smallest chosen word |
Going to office | Color the boxes |
Missing numbers | Maximum sum |
13 Reasons Why | Friend's Relationship |
Health of a person | Divisibility |
A. Movement | Numbers in a matrix |
Sequences | Split houses |
Divisible | Three primes |
Coprimes | Cost of balloons |
One String No Trouble | Help Jarvis! |
Lift queries | Goki and his breakup |
Ali and Helping innocent people | Book of Potion making |
Duration | Birthday Party |