Answer:
If it is a true mixture, the mixing enthalpy is negligible, and there is no reaction or phase change, then you can do this using exclusively the temperatures of the individual compounds and their heat capacities. Any other process that takes place needs to be taken into account separately.
The solution can be found by understanding that we’re only using state variables. You can design any complicated process that starts with the starting situation and ends up at the ending situation, and the state variables will be the same. And sometimes a complicated process is easier to calculate than the simple one-step process, like here when mixing multiple components.
One way that will work is to start by bringing all compounds to the lowest temperature of either of the compounds. All but one of the compounds must be cooled down for this; make sure to calculate for each of the components how much energy is released. Now, mix all the components together. In the simplest situation sketched above you can calculate the heat capacity of the mixture by adding all the heat capacities of the components. Use this total heat capacity to calculate how much you can heat up the mixture using the energy you saved in cooling down the components earlier. This will be your desired end situation.
In case there are any phase changes or other processes in between, you need to take the energy needed for those into account too but in very similar ways.