Suppose by contrary. i.e. $M$ is out side of $g$. draw a line from $M$ to one of intersections of $g$ with square $ABCD$. Then this segment and two vertices of square divide square in two equal part such that $g$ is is one side of this segment (i.e. in one part). this is a contradiction. because $g$ also divides the square in two equal part.