The key for this question wasn't that clear for me. I have a separation scheme in my mind:
your reactants are: amide, amine, anhydride.
you react it with NaOH
The amide could turn to a carboxylic acid
The amine could attack the anhydride to form a carboxylic acid and an amide.
Can you elaborate what happens in A?