EASY || CPP || Deque
\nclass FrontMiddleBackQueue {\npublic:\n    deque<int> P,Q;\n    FrontMiddleBackQueue() {\n        \n    }\n    \n    void pushFront(int val) {\n        P.push
```\nclass FrontMiddleBackQueue {\npublic:\n    deque<int> P,Q;\n    FrontMiddleBackQueue() {\n        \n    }\n    \n    void pushFront(int val) {\n        P.push_front(val);\n    }\n    \n    void pushMiddle(int val) {\n        int n=P.size();\n        n=n/2;\n        while(n--){\n            Q.push_back(P.front());\n            P.pop_front();\n        }\n        P.push_front(val);\n        while(!Q.empty()){\n            P.push_front(Q.back());\n            Q.pop_back();\n        }\n    }\n    \n    void pushBack(int val) {\n        P.push_back(val);\n    }\n    \n    int popFront() {\n        if(P.empty()) return -1;\n        int x=P.front();\n        P.pop_front();\n        return x;\n    }\n    \n    int popMiddle() {\n        if(P.empty()) return -1;\n        int n=P.size();\n        if(n%2==0) n=(n-1)/2;\n        else n=n/2;\n        while(n--){\n            Q.push_back(P.front());\n            P.pop_front();\n        }\n        int x=P.front();\n        P.pop_front();\n        while(!Q.empty()){\n            P.push_front(Q.back());\n            Q.pop_back();\n        }\n        return x;\n    }\n    \n    int popBack() {\n        if(P.empty()) return -1;\n        int x=P.back();\n        P.pop_back();\n        return x;\n    }\n};\n```
['Queue', 'C++']