C++ || Double LL || O(1) time for each of the operations
Intuition\nMaintain 3 pointers head, mid, tail which will point to the respective nodes in the list and an integer variable size will tell us the size of he LL.
# Intuition\nMaintain 3 pointers head, mid, tail which will point to the respective nodes in the list and an integer variable size will tell us the size of he LL. Just manipulate these pointers. Take care of few edge cases.\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n\n# Complexity\n- Time complexity: $$O(1)$$ for each operation, as we are just manipulating the pointers.\n\n- Space complexity: $$O(1)$$ \n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nstruct Node{\n\n    int val;\n    Node * next;\n    Node * prev;\n    \n    Node(int x)\n    {\n        val = x;\n        next = prev = NULL;\n    }\n};\n\n    Node* createNode(int x)\n    {\n        return new Node(x);\n    }\n\nclass FrontMiddleBackQueue {\npublic:\n    Node * head = NULL;\n    Node * tail = NULL;\n    Node * mid = NULL;\n    int size = 0;\n\n    FrontMiddleBackQueue() {}\n    \n    void pushFront(int val) {\n\n        Node * newNode = createNode(val);\n\n        if(size==0)\n            head = tail = mid = newNode;\n        else\n        {\n            newNode->next = head;\n            newNode->prev = NULL;\n            head->prev = newNode;\n            head = head->prev;\n        }\n\n        size++;\n        if(size%2==0)\n            mid = mid->prev;\n    }\n    \n    void pushMiddle(int val) {\n        Node * newNode = createNode(val);\n        if(size==0)\n            head = tail = mid = newNode;\n        else\n        {\n            if(size%2==0)//even no of elements\n            {\n                newNode->next = mid->next;\n                newNode->prev = mid;\n                mid->next->prev = newNode;\n                mid->next = newNode;\n                mid = mid->next;\n            }\n            else //odd no of elements\n            {\n                newNode->next = mid;\n                newNode->prev = mid->prev;\n                if(mid->prev)\n                    mid->prev->next = newNode;\n                mid->prev = newNode;\n                mid = mid->prev;\n                if(size==1)\n                    head = mid;\n            }\n        }\n        size++;\n    }\n    \n    void pushBack(int val) {\n        Node * newNode = createNode(val);\n        if(size==0)\n            head = tail = mid = newNode;\n        \n        else\n        {\n            newNode->prev = tail;\n            newNode->next = NULL;\n            tail->next = newNode;\n            tail = tail->next;\n        }\n        size++;\n        if(size%2!=0 && size!=1)\n            mid = mid->next;\n    }\n    \n    int popFront() {\n\n        if(size==0) return -1;\n\n        int ans = head->val;\n        Node * toDel = head;;\n        if(size==1)\n        {\n            head = mid = tail = NULL;\n        }\n        else\n        {\n            head->next->prev = NULL;\n            head = head->next;\n            if(size%2==0)\n                mid = mid->next;\n        }\n        delete toDel;\n        size--;\n        return ans;\n    }\n    \n    int popMiddle() {\n        if(size==0) return -1;\n\n        int ans = mid->val;\n        Node * toDel = mid;\n        if(size==1)\n        {\n            head = mid = tail = NULL;\n        }\n        else\n        {\n            mid->next->prev = mid->prev;\n            if(mid->prev)\n                mid->prev->next = mid->next;\n\n            if(size%2!=0) //odd no of elements\n                mid = mid->prev;\n            else\n                mid = mid->next;\n\n            if(size==2)\n                head = mid;\n\n        }\n        delete toDel;\n        size--;\n        return ans;\n    }\n    \n    int popBack() {\n\n        if(size==0) return -1;\n\n        int ans = tail->val;\n        Node *toDel = tail;\n        \n        if(size==1)\n            head = mid = tail = NULL;\n        else\n        {\n            tail->prev->next = NULL;\n            tail = tail->prev;\n            if(size%2!=0)\n                mid = mid->prev;\n            \n        }\n        delete toDel;\n        size--;\n        return ans;\n    }\n};\n\n/**\n * Your FrontMiddleBackQueue object will be instantiated and called as such:\n * FrontMiddleBackQueue* obj = new FrontMiddleBackQueue();\n * obj->pushFront(val);\n * obj->pushMiddle(val);\n * obj->pushBack(val);\n * int param_4 = obj->popFront();\n * int param_5 = obj->popMiddle();\n * int param_6 = obj->popBack();\n */\n```
['Doubly-Linked List', 'C++']