Pop from queue
q = q [ 1 : ] NEW_LINE x = up [ 0 ] NEW_LINE lev = up [ 1 ] NEW_LINE if ( lev > dist [ x ] ) : NEW_LINE INDENT continue NEW_LINE DEDENT if ( x == n - 1 ) : NEW_LINE INDENT continue NEW_LINE DEDENT