Child, Parent and Grand-Parent relationship where a child may not necessary have a parent or a grand parent
I would add hostel_id to inmate, and leave Room-id empty till he arrives and the room-number is chosen.
So you could also, allow inmate to book a specific room with sea view for example
And you could check if any rooms for a date are available, for example hostel 1 has 10 room and 10 users have chosen the hostel already, you ca tell him  that is not possible and give additional information when a room is free again or a hostel nearby who has vacancy.
table hostel(id, name)
table inmate(id,hostel_id, room_id, name, etc)
table room(id, hostel_id, room_no)