SetOfStacks implementation and test class