Design Front Middle Back Queue
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n![image.png](https://assets.leetcode.com/users/images/cec6492f-2ebe-45ff-9614-85e1aefa95af_1687808754.8704185.png)\n\n# Code\n```\nclass FrontMiddleBackQueue:\n\n    def __init__(self):\n        self.queue=[]\n        \n\n    def pushFront(self, val: int) -> None:\n        self.queue.insert(0,val)\n        \n\n    def pushMiddle(self, val: int) -> None:\n        n=len(self.queue)\n        self.queue.insert(n//2,val)\n    def pushBack(self, val: int) -> None:\n        self.queue.append(val)\n\n    def popFront(self) -> int:\n        if len(self.queue)==0:\n            return -1    \n        return self.queue.pop(0)\n        \n\n    def popMiddle(self) -> int:\n        if len(self.queue)==0:\n            return -1\n        n=len(self.queue)\n        if n%2==0:\n            n=(n//2)-1\n        else:\n            n=int(n//2)\n        return self.queue.pop(n)\n        \n\n    def popBack(self) -> int:\n        if len(self.queue)==0:\n            return -1 \n        return self.queue.pop()\n        \n\n\n# Your FrontMiddleBackQueue object will be instantiated and called as such:\n# obj = FrontMiddleBackQueue()\n# obj.pushFront(val)\n# obj.pushMiddle(val)\n# obj.pushBack(val)\n# param_4 = obj.popFront()\n# param_5 = obj.popMiddle()\n# param_6 = obj.popBack()\n```
['Python3']