```
import numpy as np
seq = [17, 5, 14, 19, 21, 7, 9, 11, 6, 4, 8]
weights = [0.4, 0.3, 0.25, 0.16, 0.33, 0.4, 0.5, 0.2, 0.17, 0.34, 0.41]
mid_weight = sum(weights) / 2
assert len(seq) == len(weights)
s = 0
for idx in reversed(np.argsort(seq)):
s += weights[idx]
if s > mid_weight:
print(seq[idx]) # 9
break
```