python3 with 2 deques solution, faster than 95%
```\nclass FrontMiddleBackQueue:\n\n    def init(self):\n        self.q1 = deque([])\n        self.q2 = deque([])\n\n    def pushFront(self, val: int) -> None:\
```\nclass FrontMiddleBackQueue:\n\n    def __init__(self):\n        self.q1 = deque([])\n        self.q2 = deque([])\n\n    def pushFront(self, val: int) -> None:\n        self.q1.appendleft(val)\n        if len(self.q1) - len(self.q2) == 2:\n            self.q2.appendleft(self.q1.pop())\n\n    def pushMiddle(self, val: int) -> None:\n        if len(self.q1) - len(self.q2) == 1:\n            self.q2.appendleft(self.q1.pop())\n        self.q1.append(val)\n\n    def pushBack(self, val: int) -> None:\n        # append first so that if q1, q2 are empty q2 can have something to popleft \n        self.q2.append(val)\n        if len(self.q1) == len(self.q2) - 1:\n            self.q1.append(self.q2.popleft())\n\n    def popFront(self) -> int:\n        if len(self.q1) == 0:\n            return -1\n        if len(self.q1) == len(self.q2):\n            self.q1.append(self.q2.popleft())\n        return self.q1.popleft()\n\n    def popMiddle(self) -> int:\n        if len(self.q1) == 0:\n            return -1\n        val = self.q1.pop()\n        if len(self.q1) + 1 == len(self.q2):\n            self.q1.append(self.q2.popleft())\n        return val   \n\n    def popBack(self) -> int:\n        if len(self.q2) == 0:\n            if len(self.q1) == 1:\n                return self.q1.pop()\n            return -1\n        val = self.q2.pop()\n        if len(self.q2) + 2 == len(self.q1):\n            self.q2.appendleft(self.q1.pop())\n        return val
['Queue', 'Python3']