#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n, e;
cin >> n >> e;
vector<pair<int, int>> adj_list[n];
while (e--)
{
int a, b, c;
cin >> a >> b >> c;
adj_list[a].push_back({b, c});
adj_list[b].push_back({a, c});
}
for (int i = 0; i < n; i++)
{
cout << i << "-> ";
for (pair<int, int> p : adj_list[i])
cout << p.first << " " << p.second << " , ";
cout << endl;
}
}
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)