public int pop(int stackId, int data){
        if(stackId == 1){
            if(topleft == -1)
                return 0;
            int num = array[this.topleft];
            this.topleft = this.topleft - 1;
            return num;
        }else if(stackId == 2){
            if(topright == -1)
                return 0;
            int num = array[this.topright];
            this.topright = this.topright + 1;
            return num;
        }else if(stackId == 3){
            if(topmiddle == basemiddle)
                return 0;
            int num = array[topmiddle];
            if(topmiddle>basemiddle)
                topmiddle = topmiddle -1;            
        }
        return 0;
        
    }