int main(void) {
    int T;
    scanf("%d", &T);
    int i;
    for(i = 0; i < T; i++) {
        Graph *graph = (Graph *)malloc(sizeof(Graph));
        int vertex_num, edge_num;
        scanf("%d %d", &vertex_num, &edge_num);
        graph->vertex_num = vertex_num;
        graph->in_degrees = (int *)malloc(sizeof(int) * graph->vertex_num);
        memset(graph->in_degrees, 0, sizeof(int) * graph->vertex_num);
        graph->adj_lists = (Edge **)malloc(sizeof(Edge *) * graph->vertex_num);
        memset(graph->adj_lists, 0, sizeof(Edge *) * graph->vertex_num);
        int k;
        for(k = 0; k < edge_num; k++) {
            int from, to;
            scanf("%d %d", &from, &to);
            from--; to--;
            Edge *edge = create_edge(to, graph->adj_lists[from]);
            graph->adj_lists[from] = edge;
            graph->in_degrees[to] += 1;
        }
        if(is_dag(graph)) {
            printf("Correct\n");
        }
        else {
            printf("Wrong\n");
        }
        destroy_graph(graph);
    }
    return 0;
}
std::pair<int, std::string> test_transitive_closure_dag(std::ostream& strm,int argc, const char *argv[])
{
      std::string fn = test_path("transitive_closure_dag.dot");
      size_t size = 50;
      sparse_graph_t s10(size, graph_type_t::DIRECTED);
      
      s10.insert(simple_edge_t(0,1,1));
      s10.insert(simple_edge_t(0,2,1));
      s10.insert(simple_edge_t(0,3,1));
      s10.insert(simple_edge_t(0,5,1));
      s10.insert(simple_edge_t(0,6,1));
      s10.insert(simple_edge_t(2,3,1));
      s10.insert(simple_edge_t(3,4,1));
      s10.insert(simple_edge_t(3,5,1));
      s10.insert(simple_edge_t(4,9,1));
      s10.insert(simple_edge_t(6,4,1));
      s10.insert(simple_edge_t(6,9,1));
      s10.insert(simple_edge_t(7,6,1));
      s10.insert(simple_edge_t(8,7,1));
      s10.insert(simple_edge_t(9,10,1));
      s10.insert(simple_edge_t(9,11,1));
      s10.insert(simple_edge_t(9,12,1));
      s10.insert(simple_edge_t(11,12,1));
      
      is_dag<simple_edge_t> is_dag(s10);
      ASSERT_CONDITION("graph is a DAG", is_dag());
      
      s10.graphviz(fn);
      transitive_closure<sparse_graph_t, tc_dag<simple_edge_t>> tc(s10);
      std::string wts = test_path("transitive_closure_dag_results.dot");
      (*tc).graphviz(wts);
      ASSERT(tc(simple_edge_t(0,1,1)));
      ASSERT(tc(simple_edge_t(0,12,1)))
      ASSERT(tc(simple_edge_t(0,11,1)));
      ASSERT(tc(simple_edge_t(8,12,1)))
      
      ASSERT(tc(simple_edge_t(0,10,1)));
      ASSERT(tc(simple_edge_t(3,4,1)))
      ASSERT(!tc(simple_edge_t(1,4,1)));
      ASSERT(!tc(simple_edge_t(4,1,1)))
      
      ASSERT(tc(simple_edge_t(0,2,1)));
      ASSERT(!tc(simple_edge_t(2,0,1)))
      ASSERT(tc(simple_edge_t(2,4,1)));
      
      return DONE;
}