a[i1] = 2
a[i2] = 4
a[i3] = 6
a[i4] = 8
4 = k
a[R+1] = 5
while (k > 1 && a[Get(i[k])] >= a[R+1])
Join(i[k], R+1), k--;
i[++k] = R+1;
Get(i) { return i == p[i] ? i : (p[i] = Get(p[i])); }
Join(a, b) { p[Get(a)] = Get(b); }
/**
1 2 3 4 5 2 3 4 5 3
[0] [1 2 3 4 5] [6 7 8 9]
0 :1
----> a[5] = 2
5 :2
-----> a[9] = 3
9 :3
*/