ABC Interview Question

Implement Bipartite graph in 20 min.