#include using namespace std; long long gcd(long long x, long long y) { if (y == 0) return x; return gcd(y, x % y); } long long lcm(long long x, long long y) { if (x == 0 || y == 0) return 0; return x / gcd(x, y) * y; } int main() { int N; cin >> N; string S; cin >> S; map mp; for (int i = 0; i < N - 1; i++) { if (S[i] != '(') continue; int cnt = 0; for (int j = i + 1; j < N; j++) { if (S[j] == '(') cnt++; else if (S[j] == ')' && cnt > 0) cnt--; else { mp[i] = j; mp[j] = i; break; } } } for (int i = 0; i < N; i++) { cout << mp[i] + 1 << endl; } }