ABC interview question

Implement Bipartite graph in 20 min.