According to the law of conservation of Mass:
In a chemical reaction mass can neither be created nor be destroyed
So, we can say that: Mass of A + Mass of B = Mass of C
In the given reaction,
One of the reactants weigh 5 grams and another one weighs x grams
The mass of the product of this reaction is 9 grams
Mass of reactant B:
Mass of A + Mass of B = Mass of C
5 + x = 9
x = 4 grams