Take a nominal weight of material say 100g.
Calculate how much X and O are present for each oxide as g.
Knowing the ratio is 1:1 for the first oxide and the weight of O is 16 calculate the molecular weight of X
From the weights of X and O in the second oxide with the molecular weight of X from above calculate the mole ratio for the second oxide.
Adjust the ratio to whole numbers and that is the formula for the second oxide.