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