#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 10, maxd = 60;
double d[maxn][maxd];
int fa[maxn];
int q, sz;
int main() {
  scanf("%d", &q);
  for (int i = (0); i <= (maxd - 1); ++i) d[1][i] = 1;
  fa[1] = -1;
  sz = 1;
  while (q--) {
    int op, u;
    scanf("%d %d", &op, &u);
    if (op == 1) {
      ++sz;
      fa[sz] = u;
      for (int i = (0); i <= (maxd - 1); ++i) d[sz][i] = 1;
      int k = 0;
      double cur = d[u][0];
      d[u][0] *= 0.5;
      while (fa[u] != -1 && ++k < maxd) {
        double tmp = d[fa[u]][k];
        d[fa[u]][k] /= (1 + cur) / 2;
        d[fa[u]][k] *= (1 + d[u][k - 1]) / 2;
        cur = tmp;
        u = fa[u];
      }
    } else {
      double ans = 0;
      for (int i = (1); i <= (maxd - 1); ++i)
        ans += i * (d[u][i] - d[u][i - 1]);
      printf("%.8lf\n", ans);
    }
  }
  return 0;
}
