I have written small program for insert edge into graph and it is generating code dump. I am trying to traverse list data. gdb debugger show me core dump location  "cout<<it->first<<endl" which is strange for me Any input
#include<iostream>
 #include<utility>
 #include<vector>
 #include<string>
 #include<list>
 using namespace std;
 class Graph {
     private:
         int V;
         list<pair <int,int> > *adj;
     public:
         Graph(int V);
         void addedge(int V, int U, int w);
         void printGraph();
 };
 Graph::Graph(int V)
 {
     this->V = V;
     adj = new list<pair <int, int> >[V];
 }
 void Graph::addedge(int V, int U, int W) {
     adj[V].push_back(make_pair(U,V));
 }
 void Graph::printGraph() {
     for(int i=0; i<V; i++){
         string s = to_string(V) + "->";
         for(list<pair<int,int> >::iterator it = adj[V].begin(); it != adj[V].end(); ++it) {
             cout<<it->first<<endl;
         }
     }
 }
 int main() {
     Graph g(10);
     g.addedge(0, 1, 2);
     g.addedge(1, 1, 2);
     g.addedge(2, 1, 2);
     g.printGraph();
     return 0;
 }
 
     
    