The 3 boys from city X must marry the 3 girls from city Y (nice how that works out!) How many different ways can that be done? The two boys from city Y must marry the 2 girls from city X. How many ways can that be done? And now that you have those two numbers, how do you combine them to answer the question.
This, as all such problems, is an application of the "fundamental principle of counting": if A can happen in n ways and B can happen in m ways, then A and B can happen together in mn ways.