//#include<stdio.h>
//int arr[100005]={}, top=-1;
//void push(int n)
//{
// top++;
// arr[top]=n;
// return;
//}
//void pop()
//{
// if (top>-1)
// {
// top--;
// }
// return;
//}
//int main()
//{
// int i,n,k,sum=0;
// scanf("%d", &n);
// for(i=1;i<=n;i++)
// {
// scanf("%d", &k);
// if (k!=0)
// {
// push(k);
// }
// else
// {
// pop();
// }
// }
// for(i=0;i<=top;i++)
// {
// sum+=arr[i];
// }
// printf("%d", sum);
// return 0;
//}
//#include<stdio.h>
//#include<string.h>
//int stack[105]={},top=-1,bol=0;
//void push()
//{
// top++;
// stack[top]=1;
// return;
//}
//void pop()
//{
// if (top>-1)
// {
// stack[top]=0;
// top--;
// }
// else
// {
// bol=1;
// }
// return;
//}
//int main()
//{
// int n, i,j,len;
// char str[60];
// scanf("%d", &n);
// for(i=1;i<=n;i++)
// {
// scanf("%s", str);
// len=strlen(str)-1;
// for(j=0;j<=len;j++)
// {
// bol = 0;
// if (str[j]=='(')
// {
// push();
// }
// else
// {
// pop();
// if (bol==1)
// {
// printf("NO\n");
// break;
// }
// }
// }
// if (bol)
// {
// while(top!=-1)
// {
// pop();
// }
// continue;
// }
// if (top==-1)
// {
// printf("YES\n");
// }
// else
// {
// printf("NO\n");
// while(top!=-1)
// {
// pop();
// }
// }
// }
// return 0;
//}
//#include<stdio.h>
//#include<string.h>
//int main()
//{
// int stack[1005]={}, top=-1;
// char str[1005]={};
// int i,j,bo=0;
// do
// {
// bo =0;
// for(i=0;str[i]!='.';i++)
// {
// scanf("%c", &str[i]);
// if (str[i]=='(')
// {
// top++;
// stack[top]=1;
// }
// else if(str[i]=='[')
// {
// top++;
// stack[top]=2;
// }
// else if (str[i]==']')
// {
// if (stack[top]!=1 && top>-1)
// {
// top--;
// }
// else
// {
// bo =1;
// printf("NO\n");
// break;
// }
// }
// else if(str[i]==')')
// {
// if (stack[top]!=2 && top>-1)
// {
// top--;
// }
// else
// {
// bo=1;
// printf("NO\n");
// break;
// }
// }
// }
// if (bo)
// {
// continue;
// }
// if (top==-1)
// {
// printf("YES\n");
// }
// else
// {
// printf("NO\n");
// top-(top+1);
// }
// }while(str!=".");
// return 0;
//}
#include<stdio.h>
int stack1[10005]={}, stack2[10005]={}, top1=-1, top2=-1;
void push1()
{
top2++;
stack2[top2]=stack1[top1];
top1--;
return;
}
void pop(int n)
{
if (n==1)
{
if (top1>-1)
{
top1--;
}
}
else
{
if (top2>-1)
{
top2--;
}
}
return;
}
int main()
{
int n,i,j,bo=0,k;
scanf("%d", &n);
for(i=1;i<=n;i++)
{
top2++;
scanf("%d", &stack2[top2]);
}
for(i=1;i<=n;i++)
{
top1++;
stack1[top1]=stack2[top2];
top2--;
}
for(i=1;i<=n;i++)
{
bo = 0;
if (stack2[top2]==i)
{
bo = 1;
pop(2);
}
while(1)
{
if (top1==-1)
{
break;
}
if (stack1[top1]==i)
{
pop(1);
bo=1;
break;
}
else
{
push1();
}
}
if (stack2[top2]==i)
{
bo = 1;
pop(2);
}
if (bo==0)
{
printf("Sad");
return 0;
}
}
printf("Nice");
return 0;
}