Problem: Imagine a real contest or exam of n participants. Every participant will get a particular score. We can predict the standings board more or less, if we do some statistics on their previous performance.

<image>

Let's say the score of the participants will be uniformly distributed in interval [li, ri] (the score can be a real number). Can you predict the standings board according to these data? In other words you should say for each participant the probability that he gets some fixed place in the scoreboard. The participants are sorted by increasing of their scores in the scoreboard. So, the participant with the largest score gets the last place.

Input

The first line contains integer n (1 ≤ n ≤ 80), showing how many participants we have. Each of the next n lines contains our predictions, the i-th line contains a pair of integers li, ri (0 ≤ li < ri ≤ 109) as the distributed interval for participant i.

Consider the participants numbered from 1 to n in some way.

Output

Output a distributed matrix a of order n. The element aij of the matrix is the probability that participant i has rank j.

Your answer will considered correct if it has at most 10 - 6 absolute or relative error.

Examples

Input

2
1 6
4 9


Output

0.9200000000 0.080 
0.080 0.9200000000 


Input

8
0 2
1 3
2 4
3 5
4 6
5 7
6 8
7 9


Output

0.875 0.125 0 0 0 0 0 0 
0.125 0.750 0.125 0 0 0 0 0 
0 0.125 0.750 0.125 0 0 0 0 
0 0 0.125 0.750 0.125 0 0 0 
0 0 0 0.125 0.750 0.125 0 0 
0 0 0 0 0.125 0.750 0.125 0 
0 0 0 0 0 0.125 0.750 0.125 
0 0 0 0 0 0 0.125 0.875 

Note

The score probability distribution is continuous, which means, there is no possibility for a draw.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(10);
  int N;
  scanf(" %d", &N);
  vector<int> L(N), R(N);
  set<int> x_posS;
  for (int i = 0; i < N; i++) {
    scanf(" %d %d", &L[i], &R[i]);
    x_posS.insert(L[i]);
    x_posS.insert(R[i]);
  }
  vector<int> x_pos;
  for (auto it = x_posS.begin(); it != x_posS.end(); it++) x_pos.push_back(*it);
  vector<vector<long double> > ans(N, vector<long double>(N, 0));
  vector<bool> bad(N, false);
  for (int x = 1; x < (int)x_pos.size(); x++) {
    int st = 0;
    for (int i = 0; i < N; i++) {
      if (x_pos[x] <= L[i]) continue;
      if (x_pos[x - 1] >= R[i]) {
        st++;
        continue;
      }
    }
    vector<vector<long double> > p_akt(N + 1 - st,
                                       vector<long double>(N + 1 - st, 0));
    p_akt[0][0] = 1;
    for (int i = 0; i < N; i++) {
      if (x_pos[x] <= L[i]) continue;
      if (x_pos[x - 1] >= R[i]) continue;
      long double p_lt = 1.0 * (x_pos[x - 1] - L[i]) / (R[i] - L[i]);
      long double p_eq = 1.0 * (x_pos[x] - x_pos[x - 1]) / (R[i] - L[i]);
      long double p3 = 1.0 * (R[i] - x_pos[x]) / (R[i] - L[i]);
      for (int j = N - st; j >= 0; j--)
        for (int k = N - st - j; k >= 0; k--)
          p_akt[j][k] = ((j == 0) ? 0 : p_akt[j - 1][k]) * p_lt +
                        ((k == 0) ? 0 : p_akt[j][k - 1]) * p_eq +
                        p_akt[j][k] * p3;
    }
    for (int i = 0; i < N; i++)
      if (!bad[i]) {
        if (x_pos[x] <= L[i] || x_pos[x - 1] >= R[i]) continue;
        long double p_lt = 1.0 * (x_pos[x - 1] - L[i]) / (R[i] - L[i]);
        long double p_eq = 1.0 * (x_pos[x] - x_pos[x - 1]) / (R[i] - L[i]);
        long double p3 = 1.0 * (R[i] - x_pos[x]) / (R[i] - L[i]);
        vector<vector<long double> > akt(N - st,
                                         vector<long double>(N - st, 0));
        if (p3 > p_lt && p3 > p_eq) {
          for (int j = 0; j < N - st; j++)
            for (int k = 0; k < N - st - j; k++)
              akt[j][k] = (p_akt[j][k] - ((k == 0) ? 0 : akt[j][k - 1]) * p_eq -
                           ((j == 0) ? 0 : akt[j - 1][k]) * p_lt) /
                          p3;
        } else if (p_eq > p_lt) {
          for (int k = N - st - 1; k >= 0; k--)
            for (int j = 0; j < N - st - k; j++)
              akt[j][k] =
                  (p_akt[j][k + 1] -
                   ((k == N - 1 - st)
                        ? 0
                        : (akt[j][k + 1] * p3 +
                           ((j == 0) ? 0 : akt[j - 1][k + 1]) * p_lt))) /
                  p_eq;
        } else {
          for (int j = N - st - 1; j >= 0; j--)
            for (int k = 0; k < N - st - j; k++)
              akt[j][k] =
                  (p_akt[j + 1][k] -
                   ((j == N - 1 - st)
                        ? 0
                        : (akt[j + 1][k] * p3 +
                           ((k == 0) ? 0 : akt[j + 1][k - 1]) * p_eq))) /
                  p_lt;
        }
        vector<long double> add(N + 1, 0);
        for (int j = 0; j < N - st; j++)
          for (int k = 0; k < N - st - j; k++) {
            if (akt[j][k] > 1.1) bad[i] = true;
            add[st + j] += akt[j][k] / (k + 1) * p_eq;
            add[st + j + k + 1] -= akt[j][k] / (k + 1) * p_eq;
          }
        long double s2 = 0;
        for (int j = 0; j < N; j++) {
          s2 += add[j];
          ans[i][j] += s2;
        }
      }
  }
  for (int i = 0; i < N; i++) {
    long double sump = 0;
    for (int j = 0; j < N; j++) sump += ans[i][j];
    if (((sump - 1 < 0) ? -(sump - 1) : sump - 1) > 1e-6) bad[i] = true;
  }
  for (int b = 0; b < N; b++)
    if (bad[b]) {
      for (int j = 0; j < N; j++) ans[b][j] = 0;
      for (int x = 1; x < (int)x_pos.size(); x++)
        if (x_pos[x] <= R[b] && x_pos[x - 1] >= L[b]) {
          int st = 0;
          for (int i = 0; i < N; i++)
            if (i != b) {
              if (x_pos[x] <= L[i]) continue;
              if (x_pos[x - 1] >= R[i]) {
                st++;
                continue;
              }
            }
          vector<vector<long double> > p_akt(
              N + 1 - st, vector<long double>(N + 1 - st, 0));
          p_akt[0][0] = 1;
          for (int i = 0; i < N; i++)
            if (i != b) {
              if (x_pos[x] <= L[i]) continue;
              if (x_pos[x - 1] >= R[i]) continue;
              long double p_lt = 1.0 * (x_pos[x - 1] - L[i]) / (R[i] - L[i]);
              long double p_eq =
                  1.0 * (x_pos[x] - x_pos[x - 1]) / (R[i] - L[i]);
              long double p3 = 1.0 * (R[i] - x_pos[x]) / (R[i] - L[i]);
              for (int j = N - st; j >= 0; j--)
                for (int k = N - st - j; k >= 0; k--)
                  p_akt[j][k] = ((j == 0) ? 0 : p_akt[j - 1][k]) * p_lt +
                                ((k == 0) ? 0 : p_akt[j][k - 1]) * p_eq +
                                p_akt[j][k] * p3;
            }
          long double p_eq = 1.0 * (x_pos[x] - x_pos[x - 1]) / (R[b] - L[b]);
          vector<long double> add(N + 1, 0);
          for (int j = 0; j < N - st; j++)
            for (int k = 0; k < N - st - j; k++) {
              add[st + j] += p_akt[j][k] / (k + 1) * p_eq;
              add[st + j + k + 1] -= p_akt[j][k] / (k + 1) * p_eq;
            }
          long double s2 = 0;
          for (int j = 0; j < N; j++) {
            s2 += add[j];
            ans[b][j] += s2;
          }
        }
    }
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      if (j > 0) printf(" ");
      printf("%.12lf", (double)((ans[i][j] < 0) ? -(ans[i][j]) : ans[i][j]));
    }
    printf("\n");
  }
  return 0;
}