1988: 链式前向星练习

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:14 Solved:5

Description

链式前向星练习

1、建立链表

2、遍历链表

Input

输入多行

第一行输入n个点,m条边

第二行开始,每行输入边的 U、V、W


Output

输出m行 每条边的 按点的先后循序输入每条边的U、V、W

Sample Input Copy

5 7
1 2 1
2 3 2
3 4 3
1 3 4
4 1 5
1 5 6
4 5 7

Sample Output Copy

1 5 6
1 3 4
1 2 1
2 3 2
3 4 3
4 5 7
4 1 5