import std.functional, std.algorithm, std.bigint, std.string, std.traits, std.array, std.range, std.stdio, std.conv; size_t bracketState(string s) { size_t bracketState = 1; size_t idx; while (bracketState != 0 && idx < s.length) { char ch = s[idx]; if (ch == '(') { bracketState++; } if (ch == ')') { bracketState--; } idx++; } return idx; } struct Pair { size_t b, e; } void main() { int N = readln.chomp.to!(int); string S = readln.chomp; Pair[] ps; size_t bi, ei; foreach (idx, s; S) { if (s == '(') { ps ~= Pair(idx, idx + S[idx+1..$].bracketState); } } size_t[] ans; ans.length = N; foreach (p; ps) { ans[p.b] = p.e; ans[p.e] = p.b; } foreach (a; ans) { writeln(a + 1); } }