Constructing the graph
for i in range ( len ( arr ) ) : NEW_LINE INDENT adj [ arr [ i ] [ 0 ] ] . append ( arr [ i ] [ 1 ] ) NEW_LINE adj [ arr [ i ] [ 1 ] ] . append ( arr [ i ] [ 0 ] ) NEW_LINE DEDENT