How can I get the categories and subcategories separately?

How can I get the categories and subcategories separately?

tech