#include <bits/stdc++.h>
using namespace std;
const int N = 50005;
typedef long long ll;
int n, h[N], v[N];
ll cnt[N], dp[N], s, m, t[N];
vector <int> g[N];
int main () {
freopen("sdoi2011_daodan.in", "r", stdin);
freopen("sdoi2011_daodan.out", "w", stdout);
cin >> n;
for (int i = 1;i <= n;i++) cin >> h[i] >> v[i];
for (int i = 1;i <= n;i++) {
int c = 0;
for (int j = 1;j < i;j++) {
if (h[j] >= h[i] && v[j] >= v[i]) {
if (dp[j] > c) c = dp[j], cnt[i] = cnt[j], g[i].clear(), g[i].push_back(j);
else if (dp[j] == c) cnt[i] += cnt[j], g[i].push_back(j);
}
}
dp[i] = c + 1; m = max(m, dp[i]);
if (!cnt[i]) cnt[i] = 1;
}
for (int i = 1;i <= n;i++) {
// cout << cnt[i] << endl;
if (m > dp[i]) continue;
s += cnt[i];
queue <int> q; q.push(i);
while (q.size()) {
int x = q.front(); q.pop();
t[x] += cnt[x];
for (int j = 0;j < g[x].size();j++) {
int y = g[x][j];
q.push(y);
}
}
}
// cout << s << endl;
cout << m << endl;
for (int i = 1;i <= n;i++) printf("%.5lf ", 1.0 * t[i] / s);
return 0;
}