Python Hard
```python3 []
class Solution:
    def minPushBox(self, grid: List[List[str]]) -> int:
        '''
        m and n are very small
        
        m * n * m * n is 20 ** 4 = 160000
        so thats all we have to do 
        '''
        directions = [(0, 1), (1, 0), (-1, 0), (0, -1)]
        M, N = len(grid), len(grid[0])
        INF = 10 ** 5

        seen = [[[[INF for _ in range(N)] for _ in range(M)] for _ in range(N)] for _ in range(M)]

       


        
        s = [0, 0, 0, 0, 0]

        for i in range(M):
            for j in range(N):
                if grid[i][j] == "B":
                    s[3] = i
                    s[4] = j
                    grid[i][j] = "."
                if grid[i][j] == "S":
                    s[1] = i
                    s[2] = j
                    grid[i][j] = "."

        seen[s[1]][s[2]][s[3]][s[4]] = 0

        

  

        h = []
        heapq.heappush(h, tuple(s))
    

        while h:
           

            val, i, j, ii, jj = heapq.heappop(h)

            # print(i, j, ii, jj)
            # print(0, 4)

            if seen[i][j][ii][jj] < val:
                continue

            # print(i, j, ii, jj)

            if grid[ii][jj] == "T":
                return val

            # moving the character
            for dx, dy in directions:
                nx, ny = i + dx, j + dy

                if (nx, ny) == (ii, jj):
                    continue

                if not (0 <= nx < M) or not (0 <= ny < N):
                    continue

                
               
                if grid[nx][ny] == "#":
                    continue

                if seen[nx][ny][ii][jj] <= val:
                    continue
                
                seen[nx][ny][ii][jj] = val
                heapq.heappush(h, (val, nx, ny, ii, jj))

            '''
            box is at (1, 1)
            o o o
            o x o
            o o o


            4 cases

            person at (0, 1) -> down or add 1 to ii
            person at (1, 0) -> right or add 1 to jj
            person at (2, 1) -> up or sub 1 to ii
            person at (1, 2) -> left or sub 1 to jj
            
            '''

            if (i + 1, j) == (ii, jj):
                nx, ny = i + 1, j
                nxx, nyy = ii + 1, jj


                if (0 <= nxx < M) and (0 <= nyy < N):
                    
                    if grid[nxx][nyy] != "#":
                    
                        nxt_val = val + 1

                        if seen[nx][ny][nxx][nyy] > nxt_val:
                            

                            seen[nx][ny][nxx][nyy] = nxt_val

                            heapq.heappush(h, (nxt_val, nx, ny, nxx, nyy))
                

           

            if (i, j + 1) == (ii, jj):
                nx, ny = i, j + 1
                nxx, nyy = ii, jj + 1

              

                if (0 <= nxx < M) and (0 <= nyy < N):

                
                    
                    if grid[nxx][nyy] != "#":
                      
                    
                    
                        nxt_val = val + 1

                     
                        if seen[nx][ny][nxx][nyy] > nxt_val:
                       
                            
                            seen[nx][ny][nxx][nyy] = nxt_val

                            heapq.heappush(h, (nxt_val, nx, ny, nxx, nyy))

            
            if (i - 1, j) == (ii, jj):
                nx, ny = i - 1, j
                nxx, nyy = ii - 1, jj


                if (0 <= nxx < M) and (0 <= nyy < N):
                    
                    if grid[nxx][nyy] != "#":
                    
                        nxt_val = val + 1

                        if seen[nx][ny][nxx][nyy] > nxt_val:
                            

                            seen[nx][ny][nxx][nyy] = nxt_val

                            heapq.heappush(h, (nxt_val, nx, ny, nxx, nyy))


            if (i, j - 1) == (ii, jj):
                nx, ny = i, j - 1
                nxx, nyy = ii, jj - 1


                if (0 <= nxx < M) and (0 <= nyy < N):
                    
                    if grid[nxx][nyy] != "#":
                    
                        nxt_val = val + 1

                        if seen[nx][ny][nxx][nyy] > nxt_val:
                            

                            seen[nx][ny][nxx][nyy] = nxt_val

                            heapq.heappush(h, (nxt_val, nx, ny, nxx, nyy))
                
     


        return -1

```
['Python3']