The only possible last move was Black playing Nxd1, before which the only possible move was White playing Nd1.
Among the pieces in the bottom half besides Black's knight, the only possible last move was Black playing Kh1-h2. At the time, there was an extra piece, specifically a knight, on g1 to block White's queen from attacking Black's king. Afterward, neither king could move, so any knight that landed on f3 was immediately captured, which Black could only accomplish with a knight of their own. For the knight on g1 to be captured or escape, Black eventually played N(x)f3+, and White eventually responded with Bxf3 to avoid checking Black.
Subsequently, White's light-squared bishop (LSB) was not captured by Black's remaining knight; otherwise, d1 would need to have been occupied by White's remaining mobile knight, but then it would also have been immobile, and White would have been unable to play Nd1 as their last move. Therefore, White's LSB must have been captured by Black's h8 rook.
Black's h8 rook must have been captured by White's knight. After that, Black's a8 rook was alive; otherwise, Black would only have been able to play a6 and h6, but White's knight would have needed more than 2 moves before being able to play Nd1.
Similarly, Black's a8 rook was not captured by White's knight; otherwise, it would only have been able to prepare Nd1 in 2 moves by starting on a7, but then Black would have had to already played a6. Therefore, Black's a8 rook must have been captured by White's dark-squared bishop (DSB).
In summary, this was the sequence of captures that took place:
- White's LSB captured Black's knight on f3
- Black's h8 rook captured White's LSB on g8*
- White's knight captured Black's h8 rook on g8/h8
- White's DSB captured Black's a8 rook on a7
- Black's knight captured White's DSB on e3*
- Black's knight captured White's knight on d1
*These squares are forced because Black's only remaining move after losing the a8 rook is h6.
See this game for an example achieving the final position.