To determine the value of \( m \) in triangle \( XYZ \), we start by using the property of exterior angles. The exterior angle to \( \angle Z \) is equal to the sum of the two remote interior angles. In this case, since \( \angle Z \) is given as \( (5m - 16)^\circ \) and the exterior angle is \( (3m + 12)^\circ \), we can set up the equation:
\[ \text{Exterior angle} = 180^\circ - \text{Interior angle} \]
To clarify, for triangle XYZ, the relationship we can use is:
\[ (3m + 12) = 180^\circ - (5m - 16) \]
Now, simplify the right side:
\[ (3m + 12) = 180 - 5m + 16 \]
Combine the constant terms on the right side:
\[ (3m + 12) = 196 - 5m \]
Next, we add \( 5m \) to both sides to get all \( m \) terms on the left:
\[ 3m + 5m + 12 = 196 \]
This simplifies to:
\[ 8m + 12 = 196 \]
Subtract \( 12 \) from both sides:
\[ 8m = 184 \]
Now, divide by \( 8 \):
\[ m = 23 \]
Thus, the value of \( m \) is \( \boxed{23} \).