Hi I have this question shown the image below. I have made two attempts at it

I want to if any of my attempts are correct. If so, which one? There is an error at line 2 of attempt 2 but my answer is how I intended. Ignore the error. I made the error because I was taking my method down from another page which had it written correctly.
Both ways are correct with the only exception that in the second try, you forget the $A$ matrix that is premultiplying the $B^T$ matrix, so it would be:
$D=(ABC^T)^{-1}AB^T(BA^TC)^{-1}=C^{-T}B^{-1}A^{-1}AB^T(BA^TC)^{-1}=(BC^T)^{-1}B^T(BA^TC)^{-1}$.
It can be seen that the answer is equal to the first try. The only property I am using to get the equivalent answers is that for A,B invertible matrices: $(AB)^{-1}=B^{-1}A^{-1}$