@Arun-K You can look at the data in the post object in a topic. For example in this topic your post is the main one so it has an index of 0.
A comment like @PitaJ 's post doesn't have a toPid field so it is a top level reply. I have directly replied your post so my post object has a toPid field.