This is why you leave this type of question till last...
Sometimes with these, you can do it by a process of trial and error, if you can't manage heartmum's logical thinking. Write out what you do know in a visual form:
=========== John ================== Jane ====
=========== David ================= Gemma===
That is, you know John is older than David, (by 2 years), you know Jane is older than Gemma (by 2 years), and you know Maria is older than David, but not by how much.
You know the list of ages 12, 11, 10, 10, and 9.
So pick one of Jane or John to be 12, and write that next to Jane's name, and cross 12 off the list.
If Jane is 12, then Gemma is 10. Cross 10 off the list.
That leaves 11, 10 and 9 on the list.
If there are two years between John and David, then they must be 11 and 9, leaving Maria as 10. So Maria and Gemma are the twins.
If you'd picked John as the 12 year old, then the numbers wouldn't work out, because David and Maria end up the same age... (Try it)
These things look even more difficult when you try to explain them in writing, but personally, I can only do them if lay them out visually. Otherwise, the logic defeats me!