Well, you'll end up with one equation:

12 times the number of 12v batteries + 6 times the number of 6v batteries = 84

Since you've only got one equation, you've got to write it so it only has one variable. So, if you've got x batteries in one group, then there must be 10-x batteries left. So ...

Note, it doesn't matter which battery type goes where, so this gets the same result ...

-Scott