Implementation of three stacks using a single array