The best way to rewrite the underlined part of the sentence is:
D: "climbing the hills nearby 30 times, spending nights in the open and testing to see."
This option maintains parallel structure with the phrases "climbing," "spending," and "testing," ensuring grammatical consistency throughout the sentence.
The correct option is (D): climbing the hills nearby 30 times, spending nights in the open and testing to see