Mass does not change anywhere in the space .
So the given 30N is equal to the product of mass of the body and the acceleration due to gravity at that place in space.
After finding the mass of the body multiply it by the given acceleration due to gravity.
Mg is the approximate force due to gravity between the mass and the planet.
I hope this may help you.