#pragma GCC optimize ("O3")#include<iostream>#include<cstdio>#include<cstring>#include<cmath>#include<string>#include<algorithm>#include<map>#include<set>#include<list>#include<queue>#include<stack>#include<vector>usingnamespace std;#define fori(i,a,b) for(int i=(a);i<(b);i++)#define ford(i,a,b) for(int i=(a)-1;i>=(b);i--)#define mem(a,b) memset((a),(b),sizeof(a));#define all(x) (x).begin(),(x).end()template<classT,classT2>boolckmax(T& a, T2 b){return a < b ? a = b,1:0;}template<classT,classT2>boolckmin(T& a, T2 b){return a > b ? a = b,1:0;}typedeflonglong ll;constint maxn =1e3+8;struct edge
{int to, value;};
vector<edge>nodes[maxn];voidaddedge(int a,int b,int value){
nodes[a].push_back({ b, value });
nodes[b].push_back({ a, value });}intmain(void){int n, m;// 點的個數、邊的個數int a, b, v;// 邊的頂點、邊權int len;puts("請輸入點的個數、邊的個數:");scanf("%d %d",&n,&m);puts("請輸入每條邊的起點、終點及邊權:");fori(i,0, m){scanf("%d %d %d",&a,&b,&v);addedge(a, b, v);}fori(i,1, n +1){for(edge temp : nodes[i]){printf("from:%d to:%d value:%d\n", i, temp.to, temp.value);}}return0;}