I recently solved a problem chess.com and it is below. What I don't understand is that why black moved its rook to h8 (1...Rh8). I think that black's position would have been better if it was something like 1...Rf7. Is 1...Rh8 really the best move for black? If yes, why? If not, what is the best possible move, though black is about to lose?
[FEN "8/p6r/5R2/5N1k/5K1p/7P/8/8 w - - 0 1"] 1.Ra6 Rh8 2.Ng7#