def quick_sort(q,l,r):
if l>=r:
return
i = l-1
j = r+1
p = q[l+r>>1]
while i<j:
while True:
i+=1
if q[i]>=p:
break
while True:
j-=1
if q[j]<=p:
break
if i<j:
q[i],q[j] = q[j],q[i]
quick_sort(q,l,j)
quick_sort(q,j+1,r)