Explanation:
the sum of all angles around a single point on one side of a line is always 180° (imagine the line being an extended diameter of a circle, and the point being the center of such a circle, then every side of the line represents a half-circle, which represents 180°).
so,
149 + p = 180
p = 180 - 149 = 31°
now, when 2 lines intersect, the angles at the intersection point are the same on each side of any of the lines, just left-right mirrored.
therefore, q = p = 31°.
and then again,
59 + q + w = 180
59 + 31 + w = 180
90 + w = 180
w = 90°