For the time being, let us assume that the Earth is spherical and its density depends on the radial distance from its centre. The magnitude of the gravitational force acting on the particle with mass m, located on the surface of the Earth r from Earth's center can written as
F = GMem/r^2...... 1 . where, Me = mass of the Earth, G = Universal grvitational constant.
From Newton's second law, this F can be written as
F = mg ....... 2 . where g = acceleration due to gravity
Equating 1 and 2 you get,
g = GMe/r^2.... 3
m and m will cancel out each other.
3 says that, *no matter what the mass of an object is, its acceleration under free fall gravity will always be g if and only if object is dropped near the surface of the Earth*
Radius of planet X is thrice the radius of Earth.
Plug R = 3R in equation 3 and let Mx be the mass of planet X, you will get,
g = GMx/9R.......... 4
I wrote about g for planet X because it's been given that her weight is same on both the planets.
Now divide 3 and 4 to get relation between Mx and Me (: