s,t=[],[0]* n for i in range(n): if s[i]=='(':s.append(i) else: j=s.pop() t[i],t[j]=j,i print(t[k-1]+1)