sort a stack