I know this question sounds lame, but the book I am following doesn't use the answer I expect and it has been using a similar notations everywhere else which has confused me.
I think Q[Any tensor] transpose Q can be written as Q(im)Q(mj), but the book has written Q(im)Q(jm) which, in my opinion, doesn't even satisfy the condition of matrix multiplication, so it should be wrong.