Help in multiple habtm

Hi

I have 4 tables:

people, location, categories, subcategories

people have many locations
locations have many people

categories have many subcategories
subcategories have many categories

people belong to single category based on location

so if people belong to multiple locations, they can have multiple categories in this case

I am not able to build the relationship using the tables, is there any other way I can develop the above relations

request guidance