------
## 最终结论
```python
def min_break_cost(n, m, k):
    # Initialize a 3D dp array with infinity
    dp = [[[float('inf')] * (k + 1) for _ in range(m + 1)] for _ in range(n + 1)]
    
    # Base case: no cost to eat 0 squares
    dp[0][0][0] = 0
    
    # Iterate over all possible dimensions and required squares
    for i in range(1, n + 1):
        for j in range(1, m + 1):
            for eat in range(1, k + 1):
                # If we can take the whole chocolate bar
                if eat <= i * j:
                    dp[i][j][eat] = min(dp[i][j][eat], 0)
                
                # Try horizontal cuts
                for h in range(1, i):  # h is the height of the top piece
                    cost = j * j
                    for left_eat in range(eat + 1):  # left_eat is how many to eat from the top piece
                        if left_eat <= h * j:
                            right_eat = eat - left_eat
                            if right_eat <= (i - h) * j:
                                dp[i][j][eat] = min(dp[i][j][eat], dp[h][j][left_eat] + dp[i - h][j][right_eat] + cost)
                
                # Try vertical cuts
                for v in range(1, j):  # v is the width of the left piece
                    cost = i * i
                    for left_eat in range(eat + 1):  # left_eat is how many to eat from the left piece
                        if left_eat <= i * v:
                            right_eat = eat - left_eat
                            if right_eat <= i * (j - v):
                                dp[i][j][eat] = min(dp[i][j][eat], dp[i][v][left_eat] + dp[i][j - v][right_eat] + cost)

    return dp[n][m][k]

# Read the number of test cases
t = int(input())

# Process each test case
for _ in range(t):
    n, m, k = map(int, input().split())
    print(min_break_cost(n, m, k))
```