Graph. Shortest path question

https://ide.codingblocks.com/#/s/20878

Hello, I have tried the algorithm with sample test cases as well as some cases of my own, yet on submission I am getting wrong answer. Please help me where I am getting the problem.

2 4 2 1 2 1 3 1 3 1 2 3 2

This is the sample input

Sample output
6 6 -1 -1 6