Solve each of the following systems of equations using matrix method.
x + y + z = 6;
x + 2z = 7;
3x + y + z = 12.