Let the valency of X in XH3 is x.
Valency of H = 1 (Given)
As, NH3 is a neutral molecule, so,
So, the valency of X is 3.
Let's assume the valency of Y in YX2 = y
Valency of X = 3
As, YX2 is a neutral molecule, so,
So, the valency of Y in YX2 is 6.
Hence, the valency of X is 3 and valency of Y is 6.