What's wrong with this code

@Narasimha
since you are printing all the answer in one bfs you should store the answer or csf for a particular vertex in an array then print the resulting arrays and if bfs is unable to visit any node then you must print -1.

@Narasimha
here i made few modification to your code if you have any doubt feel free to ask

@Narasimha
please mark your code as resolved in my doubt section and rate me as well.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.