Insert into position vector according to infront value
for i in range ( len ( vp ) ) : NEW_LINE INDENT height = vp [ i ] [ 0 ] NEW_LINE k = vp [ i ] [ 1 ] NEW_LINE pos [ k ] = height NEW_LINE DEDENT first = - 1 NEW_LINE second = - 1 NEW_LINE for i in range ( n ) : NEW_LINE INDENT if ( pos [ i ] == a ) : NEW_LINE INDENT first = i NEW_LINE DEDENT if ( pos [ i ] == b ) : NEW_LINE INDENT second = i NEW_LINE DEDENT DEDENT return abs ( first - second ) NEW_LINE