Two rules one for parallel one for series:
Batteries in parallel: What you purpose: you may mix and match size and age,, YES there is some "Danger" in mixing as opposed to matching however it is rather small.. So yes you can put a 24 and a 27 and a 29 and a 31 in parallel.
Rule #2, Batteries in series DOES NOT APPLY TO YOUR CASE YOU MAY STOP READING NOW
When you put two batteries in series, those two batteries essentally become "one" (Each one is half of a higher voltage battery) Thus they MUST be IDENTICAL.. Same make, Model, Size Age.. Once you attach that series jumper treat them exactly as you would a big 12 volt battery (example Two GC-2 Golf Car batteries, in series =about= a 4D)
So if you ever decide to upgrade to a pair of GC2 in serels (roughly 220 amp hours at 12 volt) think of the pair as one big 12 volt and many questions, Such as the one above, vanish (Woudl you want a 12 volt battery where 3 cells came from a 27 and 3 from a 24,, Clearly not,, Same applies to pairs of six volt)
Just remember, do not read past the shouted line till you go six volt
.