corrected adjacency list writing