Modeling a hostel management system

Hello, i am a beginner python developer and i just love the fact that frappe is “batteries included”. I have been developing a “Hostel Mamagement System” on the framework. Everything is going great but i am stuck at a particular issue.

I have a block, the block has rooms and the rooms has beds. How do i go about making a relationship in frappe? I am aware of the link fileds, but i could only make one level of one to many relationships. What is the protocol for multiple level of one to many relationships?

Also i want to automatically populate options based on the previous selections of block or rooms.

Any help will be highly appreciated.

Checkout nestedset/tree doctypes if it helps.

e.g. Warehouse, Account, Cost Center