#include <bits/stdc++.h>
using namespace std;
double power(double a, int b) {
  double out = 1;
  while (b) {
    if (b & 1) out = out * a;
    a = a * a;
    b >>= 1;
  }
  return out;
}
double f[500010][45];
int fa[500010], ch[500010];
int opt, x, T, cnt;
int main() {
  fill(f[1], f[1] + 41, 1);
  scanf("%d", &T);
  cnt = 1;
  while (T--) {
    scanf("%d%d", &opt, &x);
    if (opt == 1) {
      cnt++;
      fa[cnt] = x;
      ch[x]++;
      double lst = f[x][0];
      f[x][0] = power(0.5, ch[x]);
      for (int i = 0; i <= 40; i++) f[cnt][i] = 1;
      for (int i = 1; i <= 40; i++) {
        int np = fa[x];
        if (!np) break;
        double tmp = f[np][i];
        f[np][i] /= (0.5 + 0.5 * lst);
        f[np][i] *= (0.5 + 0.5 * f[x][i - 1]);
        lst = tmp;
        x = np;
      }
    } else {
      double ans = 0;
      for (int i = 1; i <= 40; i++) ans += (f[x][i] - f[x][i - 1]) * i;
      printf("%.10lf\n", ans);
    }
  }
  return 0;
}
