35 killed as troops battle militants in northwest Pakistan