Switching to HashMap of HashMap in main to store the dag.