Two floors are between C and F.
E lives below C but above B.
F lives immediately west of A.
| Case 1 | Case 2 |
| Flat P | Flat Q | Flat P | Flat Q |
Floor 4 | C | | | C |
Floor 3 | | | | |
Floor 2 | | | | |
Floor 1 | F | A | F | A |
Only one floor is between D and B.
B and C live in the same flat.
| Case 1 | Case 2 |
| Flat P | Flat Q | Flat P | Flat Q |
Floor 4 | C | D | D | C |
Floor 3 | | | | |
Floor 2 | B | | | B |
Floor 1 | F | A | F | A |
E and H lives on the same floor.
E lives below C but above B.
H does not live in the same flat as B and F.
Thus, Case 2 gets cancelled.
| Case 1 |
| Flat P | Flat Q |
Floor 4 | C | D |
Floor 3 | E | H |
Floor 2 | B | |
Floor 1 | F | A |
Now, only G is remaining.
| Flat P | Flat Q |
Floor 4 | C | D |
Floor 3 | E | H |
Floor 2 | B | G |
Floor 1 | F | A |
This is the final arrangement.
C lives with D on floor 4.