#### Alien landlord problem based on graph Algorithms

An alien spaceship is attacking on earth.The aliens want to destroy most of the civilization and make remaining ones their slave.They know all the major cities. Your task as a slave to find path for the spaceship to destroy all the cities and kill your brethren. You know distance of some cities from your current City.

Note:
1- Cities destroyed can be allowed to visit again.
2- Current location of spaceship is 0.

Input specification:
Input 1-Number of Cities
Input 3-Array representing one way road between x and y and distance between them is w represented as{x,y,w}.

Output Specification:
Your output return the order in which cities are destroyed by spaceship,where spaceship travel the minimum distance.

Example 1:

Input 1:7
Input 2:6
Input 3:{{0,1,1},{0,3,2},{0,4,5},{1,2,3},{4,5,4},{5,6,4}}

Output:0121030456

Example 2

Input 1:7
Input 2:8
Input 3:{{0,1,6},{1,2,7},{0,3,1},{3,6,9},{2,3,5},{0,4,2},{4,5,8},{5,6,2}}

Output:03630454012

Source: Windows Questions C++