Amazon Interview Question

build an adjacency list from the given input.