def isSorted(lst):
order = lst[0] - lst[1]
for i in range(1,len(lst)-1):
if (lst[i] - lst[i+1])*order<0:
return False
return True
lst = list(map(int,input().split(',')))
if isSorted(lst):
print('The list is already sorted')
else:
print('The list is not sorted')