Two elements X and Y have valencies of 5 and 3, and 3 and 2, respectively. The elements X and Y are most likely to be respectively:

Nitrogen have 5 electrons in the outermost shell of its atom, hence its valencies are 5 and 3. Iron can lose 2 and 3 electrons from its outermost shell, so its valencies are 2 and 3.

39