Three Stack Implementation