Given an n x n matrix of integers represented as a list of lists, rotate the matrix 90 degrees clockwise in place. Modify the input matrix directly and return it. You may not allocate another n x n matrix for the result.
def rotate_matrix(matrix):