#include<stdio.h>
int stack[1001]={};
int top = 0;
void push(int data) {
top++;
stack[top] = data;
}
int pop() {
return stack[top--];
}
int main() {
int n;
int a = 0;
int check = 0;
int f[1001]={};
char sx[1001]={};
scanf("%d",&n);
for(int i=0; i<n; i++) {
scanf("%d", &f[i]);
}
for(int i=0; i<n ; i++) {
push(f[i]);
sx[a] = 'S';
a++;
printf("I : %d, F[i] : %d\n",i,f[i]);
printf("stack[top-1] : %d\n",stack[top-1]);
printf("f[check] : %d\n",f[check]);
if(stack[top-1] == f[check]) {
printf("반복문 전 TOP-1 : %d, CHECK : %d\n",stack[top-1],check);
while(1) {
pop();
check++;
sx[a] = 'X';
a++;
printf("반복문 안 TOP-1 : %d, CHECK : %d\n",stack[top-1],check);
if(stack[top-1] != f[check]) {
//printf("TOP-1 : %d, CHECK : %d\n",stack[top-1],check);
break;
}
}
}
}
if(check == f[n] && top == 0) {
printf("%s",sx);
}
else {
printf("IMPOSSIBLE\n");
printf("TOP-1 : %d, CHECK : %d\n",stack[top-1],check);
printf("CHECK :%d, TOP : %d",check,top);
}
}