#include <cstdio>
#include <queue>
#include <vector>
#include <utility>
using namespace std;
int n,p[1000005],to[1000005],cnt;
char s[1000005],t[1000005];
priority_queue < int,vector <int>,greater <int> > q;
int main(){
scanf("%d",&n);
for(int i = 1;i <= n;i++){
scanf("%d",&p[i]);
to[p[i]] = i;
}
for(int i = 1;i <= n;i += 2){
if(i > 1){
q.push(to[i - 1]);
}
q.push(to[i]);
int tmp = q.top();
q.pop();
s[p[tmp]] = t[tmp] = '(';
}
q.push(to[n]);
while(q.size()){
int tmp = q.top();
q.pop();
s[p[tmp]] = t[tmp] = ')';
}
for(int i = 1;i <= n;i++){
if(t[i] == '('){
cnt++;
}
else{
cnt--;
}
if(cnt < 0){
printf("NIE");
return 0;
}
}
printf("%s",s + 1);
return 0;
}