#include <bits/stdc++.h>
const int MAXN = 500005;
int q, n, fa[MAXN], op, x;
double f[MAXN][40];
inline void Modify(int u, int v) {
  fa[v] = u;
  for (register int j = 0; j < 40; ++j) f[v][j] = 1.0;
  double last = 0.5 * (1 + f[u][0]), tmp;
  f[u][0] *= 0.5;
  for (register int i = 1; i < 40; ++i) {
    v = u;
    u = fa[u];
    tmp = 0.5 * (1 + f[u][i]);
    f[u][i] = f[u][i] / last * 0.5 * (1 + f[v][i - 1]);
    last = tmp;
  }
}
inline double calc(int u) {
  double res = 0.0;
  for (register int i = 1; i < 40; ++i) res += i * (f[u][i] - f[u][i - 1]);
  return res;
}
int main() {
  scanf("%d", &q);
  ++n;
  for (register int j = 0; j <= 40; ++j) f[n][j] = 1.0;
  for (register int i = 1; i <= q; ++i) {
    scanf("%d%d", &op, &x);
    if (op == 1)
      Modify(x, ++n);
    else
      printf("%.6lf\n", calc(x));
  }
  return 0;
}
