#include #include #include using namespace std; const int maxn = 1e5 + 10; vector graph[maxn]; int main() { int num_of_vertices; cin >> num_of_vertices; int num_of_edges; cin >> num_of_edges; for(int i = 0; i < num_of_edges; i++) { int a, b; cin >> a >> b; graph[a].push_back(b); // one directioanl graph[b].push_back(a); // two directioanal } for(int i = 0; i < num_of_vertices; i++) { cout << i << " --> "; for(int j = 0; j < (int) graph[i].size(); j++) { cout << graph[i][j] << ", "; } cout << endl; } return 0; }