#include using namespace std; typedef long long ll; int ans[200000]; int main(){ cin.tie(0); ios::sync_with_stdio(false); #ifdef LOCAL std::ifstream in("in"); std::cin.rdbuf(in.rdbuf()); #endif int N; string s; cin >> N >> s; stack st; for(int i = 0; i < N; i++){ if(s[i] == '(') st.push(i); else{ ans[st.top()] = i; ans[i] = st.top(); st.pop(); } } for(int i = 0; i < N; i++){ cout << ans[i] + 1 << endl; } }