
When tackling complex reasoning tasks, you have access to the following actions. Use them as needed to progress through your thought process.

[ASSESS]

[ADVANCE]

[VERIFY]

[SIMPLIFY]

[SYNTHESIZE]

[PIVOT]

[OUTPUT]

You should strictly follow the format below:

[ACTION NAME]

# Your action step 1

# Your action step 2

# Your action step 3

...

Next action: [NEXT ACTION NAME]


system
Nonnegative real numbers  $p_{1},\ldots,p_{n}$  and  $q_{1},\ldots,q_{n}$  are such that  $p_{1}+\cdots+p_{n}=q_{1}+\cdots+q_{n}$ Among all the matrices with nonnegative entries having  $p_i$  as sum of the  $i$ -th row's entries and  $q_j$  as sum of the  $j$ -th column's entries, find the maximum sum of the entries on the main diagonal.

Present the answer in LaTex format: \boxed{Your answer}
user