#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 20;
double f[maxn][36];
int m, x, t, v;
int pr[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> m;
  v = 1;
  cout.precision(10);
  for (int i = 0; i <= 35; i++) f[1][i] = 1;
  for (int i = 1; i <= m; i++) {
    cin >> t >> x;
    if (t == 1) {
      v++;
      pr[v] = x;
      for (int j = 0; j <= 35; j++) f[v][j] = 1;
      double prev = f[x][0];
      f[x][0] = f[x][0] * 0.5;
      if (x != 1) {
        for (int j = 1; j <= 35; j++) {
          int q = pr[x];
          double cur = f[q][j];
          f[q][j] = f[q][j] * (f[x][j - 1] + 1) / (prev + 1);
          prev = cur;
          if (q == 1) break;
          x = q;
        }
      }
    } else {
      long double ans = 0;
      for (int j = 1; j <= 35; j++) ans += (f[x][j] - f[x][j - 1]) * j;
      cout << fixed << ans << "\n";
    }
  }
  return 0;
}
