Formula for different levels




I have a list which is a Flat list but has different levels(Note- we cannot make it as a hierarchy, it has to be a Flat list).


List has list items like below.(Column A). And Line items Column B,C,D. Here, Asia and Europe are at top most level(level 1). They have child items like 1.1 China,2.1 France etc. Similarly China has a child like 1.1.2 Beijing and so on.


In my line items (Level 1 parent-Column B, Level 2 parent-Column C, Level 3-Column D), I want to write formulas such that I can get the List items in each level. Exactly as below. Note, Suppose in Future I add more list items  like 3. America , 4.Canada. this should still work. Please can anyone help me as early as possible on this.