Driver code
if __name__ == " _ _ main _ _ " : NEW_LINE INDENT n = 10 NEW_LINE g = [ [ ] for _ in range ( n + 1 ) ] NEW_LINE g [ 1 ] . append ( 2 ) NEW_LINE g [ 2 ] . append ( 1 ) NEW_LINE g [ 1 ] . append ( 3 ) NEW_LINE g [ 3 ] . append ( 1 ) NEW_LINE g [ 1 ] . append ( 4 ) NEW_LINE g [ 4 ] . append ( 1 ) NEW_LINE g [ 2 ] . append ( 5 ) NEW_LINE g [ 5 ] . append ( 2 ) NEW_LINE g [ 2 ] . append ( 6 ) NEW_LINE g [ 6 ] . append ( 2 ) NEW_LINE g [ 3 ] . append ( 7 ) NEW_LINE g [ 7 ] . append ( 3 ) NEW_LINE g [ 4 ] . append ( 10 ) NEW_LINE g [ 10 ] . append ( 4 ) NEW_LINE g [ 8 ] . append ( 7 ) NEW_LINE g [ 7 ] . append ( 8 ) NEW_LINE g [ 9 ] . append ( 7 ) NEW_LINE g [ 7 ] . append ( 9 ) NEW_LINE v = [ 7 , 3 , 8 ] NEW_LINE print ( findLCA ( n , g , v ) ) NEW_LINE DEDENT