You are correct in thinking that the columns of the first matrix must match with the rows of the second matrix.
So for example, we can multiply a 1 x 5 matrix with a 5 x 7 matrix. The two matching '5's are directly what make multiplication possible in this case. For your problem, the first two '3's match and multiplication is possible.
The rows of the first matrix don't need to match with the columns of the second matrix.