Chicago - 106 miles to chicago

Question Link: https://hack.codingblocks.com/contests/c/948/845
Code Link: https://ide.codingblocks.com/s/105641
2 Test Cases are showing wrong,Not able to understand where…
I have used bfs in this code…
Initially I have done it using dfs: https://ide.codingblocks.com/s/105651 but the same 2 test cases were showing TLE.