Divide, then Ground: Adapting Frame Selection to Query Types for Long-Form Video Understanding