Bfs shortest path

my code is running perfectly fine on IDE but not passing any test case . Can you please let me know where i m lagging.

You have not push x into the queue when dist[x]==-1