#include <bits/stdc++.h>
using namespace std;
const long long size = 200007;
const long long modulo = 1000000007;
const int oo = 1e9;
const double EPS = 1e-2;
const double PI = acos(-1.0);
short dp[607][607];
short l[607], r[607];
void f(int st, int fin) {
  if (st > fin)
    return;
  else if (st == fin)
    cout << "()";
  else {
    int mid = dp[st][fin];
    cout << "(";
    f(st + 1, mid);
    cout << ")";
    f(mid + 1, fin);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> l[i] >> r[i];
  for (int i = 1; i <= n; i++)
    if (l[i] == 1) dp[i][i] = i;
  for (int len = 2; len <= n; len++)
    for (int st = 1; st + len <= n + 1; st++) {
      int fin = st + len - 1;
      if (l[st] == 1 && dp[st + 1][fin] > 0) dp[st][fin] = st;
      if (l[st] <= 2 * len - 1 && r[st] >= 2 * len - 1 && dp[st + 1][fin] > 0)
        dp[st][fin] = fin;
      for (int mid = st + 1; mid < fin && dp[st][fin] == 0; mid++) {
        int in_len = mid - st + 1;
        if (l[st] <= 2 * in_len - 1 && r[st] >= 2 * in_len - 1 &&
            dp[st + 1][mid] > 0 && dp[mid + 1][fin] > 0)
          dp[st][fin] = mid;
      }
    }
  if (dp[1][n] == 0)
    cout << "IMPOSSIBLE\n";
  else
    f(1, n);
  return 0;
}

### Prompt

Generate a cpp solution to the following problem:

Notice that the memory limit is non-standard.

Recently Arthur and Sasha have studied correct bracket sequences. Arthur understood this topic perfectly and become so amazed about correct bracket sequences, so he even got himself a favorite correct bracket sequence of length 2n. Unlike Arthur, Sasha understood the topic very badly, and broke Arthur's favorite correct bracket sequence just to spite him.

All Arthur remembers about his favorite sequence is for each opening parenthesis ('(') the approximate distance to the corresponding closing one (')'). For the i-th opening bracket he remembers the segment [li, ri], containing the distance to the corresponding closing bracket.

Formally speaking, for the i-th opening bracket (in order from left to right) we know that the difference of its position and the position of the corresponding closing bracket belongs to the segment [li, ri].

Help Arthur restore his favorite correct bracket sequence!

Input

The first line contains integer n (1 ≤ n ≤ 600), the number of opening brackets in Arthur's favorite correct bracket sequence. 

Next n lines contain numbers li and ri (1 ≤ li ≤ ri < 2n), representing the segment where lies the distance from the i-th opening bracket and the corresponding closing one. 

The descriptions of the segments are given in the order in which the opening brackets occur in Arthur's favorite sequence if we list them from left to right.

Output

If it is possible to restore the correct bracket sequence by the given data, print any possible choice.

If Arthur got something wrong, and there are no sequences corresponding to the given information, print a single line "IMPOSSIBLE" (without the quotes).

Examples

Input

4
1 1
1 1
1 1
1 1


Output

()()()()


Input

3
5 5
3 3
1 1


Output

((()))


Input

3
5 5
3 3
2 2


Output

IMPOSSIBLE


Input

3
2 3
1 4
1 4


Output

(())()

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long size = 200007;
const long long modulo = 1000000007;
const int oo = 1e9;
const double EPS = 1e-2;
const double PI = acos(-1.0);
short dp[607][607];
short l[607], r[607];
void f(int st, int fin) {
  if (st > fin)
    return;
  else if (st == fin)
    cout << "()";
  else {
    int mid = dp[st][fin];
    cout << "(";
    f(st + 1, mid);
    cout << ")";
    f(mid + 1, fin);
  }
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> l[i] >> r[i];
  for (int i = 1; i <= n; i++)
    if (l[i] == 1) dp[i][i] = i;
  for (int len = 2; len <= n; len++)
    for (int st = 1; st + len <= n + 1; st++) {
      int fin = st + len - 1;
      if (l[st] == 1 && dp[st + 1][fin] > 0) dp[st][fin] = st;
      if (l[st] <= 2 * len - 1 && r[st] >= 2 * len - 1 && dp[st + 1][fin] > 0)
        dp[st][fin] = fin;
      for (int mid = st + 1; mid < fin && dp[st][fin] == 0; mid++) {
        int in_len = mid - st + 1;
        if (l[st] <= 2 * in_len - 1 && r[st] >= 2 * in_len - 1 &&
            dp[st + 1][mid] > 0 && dp[mid + 1][fin] > 0)
          dp[st][fin] = mid;
      }
    }
  if (dp[1][n] == 0)
    cout << "IMPOSSIBLE\n";
  else
    f(1, n);
  return 0;
}

```