C++ two BFS solution
```\nclass Solution {\npublic:\n    \n    vector dx = {0, 1, 0, -1};\n    vector dy = {1, 0, -1, 0};\n    pair B;\n    pair P;\n    pair T;\n    \n    struct no
```\nclass Solution {\npublic:\n    \n    vector<int> dx = {0, 1, 0, -1};\n    vector<int> dy = {1, 0, -1, 0};\n    pair<int, int> B;\n    pair<int, int> P;\n    pair<int, int> T;\n    \n    struct node {\n        int x;\n        int y;\n        int px;\n        int py;\n        node(int x, int y, int px, int py) : x(x), y(y), px(px), py(py) {\n            \n        };\n        string to_string() {\n            return std::to_string(x) + "-" + \n                   std::to_string(y) + "-" + \n                   std::to_string(px) + "-" + \n                   std::to_string(py);\n            \n        }\n    };\n    \n    bool inside(vector<vector<char>>& grid, int x, int y) {\n        return x >= 0 && y >= 0 && x < grid.size() && y < grid[0].size();\n    }\n\n    bool canReachPosition(vector<vector<char>>& grid, \n                          int px, int py,\n                          int tx, int ty, \n                          int bx, int by) {\n        if(!inside(grid, tx, ty)) return false;\n        if(grid[tx][ty] == \'#\') return false;\n        \n        int m = grid.size(), n = grid[0].size();\n        \n        vector<vector<bool>> seen(m, vector<bool>(n, false));\n        queue<pair<int, int>> q;\n        q.push({px, py}); \n        seen[px][py] = true;\n        seen[bx][by] = true;\n        \n        while(!q.empty()) {\n            int x = q.front().first, y = q.front().second; q.pop();\n            if(x == tx && y == ty) return true;\n            \n            for(int k = 0; k < 4; k++) {\n                int nx = x + dx[k], ny = y + dy[k];\n                if(!inside(grid, nx, ny)) continue;\n                if(seen[nx][ny] || grid[nx][ny] == \'#\') continue;\n                q.push({nx, ny});\n                seen[nx][ny] = true;\n            }\n        }\n        return false;\n    }\n    \n    vector<node> expand(vector<vector<char>>& grid, node n) {\n        vector<node> nodes;\n        int bx = n.x,  by = n.y;\n        int px = n.px, py = n.py;\n        \n        for(int k = 0; k < 4; k++) {\n            int nbx = bx + dx[k], nby = by + dy[k];\n            int tx  = bx - dx[k], ty  = by - dy[k];\n            \n            if(!inside(grid, nbx, nby)) continue;\n            if(grid[nbx][nby] == \'#\') continue;\n            \n            if(canReachPosition(grid, px, py, tx, ty, bx, by))\n                nodes.push_back(node(nbx, nby, bx, by));\n        }\n        return nodes;\n    }\n    bool canReachBox(vector<vector<char>>& grid) {\n        int px = P.first, py = P.second;\n        int bx = B.first, by = B.second;\n        for(int k = 0; k < 4; k++) {\n            int tx = bx + dx[k];\n            int ty = by + dy[k];\n            if(!inside(grid, tx, ty)) continue;\n            if(grid[tx][ty] == \'#\') continue;\n            if(canReachPosition(grid, px, py, tx, ty, bx, by)) return true;\n        }\n        return false;\n    }\n    \n    int minPushBox(vector<vector<char>>& grid) {\n        int m = grid.size(), n = grid[0].size();\n        \n        for(int i = 0; i < m; i++) {\n            for(int j = 0; j < n; j++) {\n                if(grid[i][j] == \'B\') {\n                    B = make_pair(i, j);\n                    grid[i][j] = \'.\';\n                } \n                else if(grid[i][j] == \'S\') {\n                    P = make_pair(i, j);\n                    grid[i][j] = \'.\';\n                } else if(grid[i][j] == \'T\') {\n                    T = make_pair(i, j);\n                    grid[i][j] = \'.\';\n                } \n            }\n        }\n        if(!canReachBox(grid)) return -1;\n        \n        \n        queue<node> q;\n        unordered_set<string> seen;\n        for(int k = 0; k < 4; k++) {\n            int tx = B.first + dx[k];\n            int ty = B.second + dy[k];\n            if(!canReachPosition(grid, P.first, P.second, tx, ty, B.first, B.second)) \n                continue;\n            auto nd = node(B.first, B.second, tx, ty);\n            q.push(nd);\n            seen.insert(nd.to_string());\n        }\n        int steps = 0;\n        while(!q.empty()) {\n            for(int t = q.size(); t > 0; t--) {\n                auto node = q.front(); q.pop();\n                int x = node.x, y = node.y;\n                if(x == T.first && y == T.second) return steps;\n                auto nodes = expand(grid, node);\n                \n                for(auto &node : nodes) {\n                    if(seen.count(node.to_string())) continue;\n                    q.push(node);\n                    seen.insert(node.to_string());\n                }   \n            }\n            steps++;\n        }\n        return -1;\n    }\n};
['Breadth-First Search', 'C']