#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int f = 1, x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void write(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline void print(int x) {
  write(x);
  printf(" ");
}
double f[510000][45];
int fa[510000], son[510000];
double pow_mod(double a, int b) {
  double ret = 1;
  while (b) {
    if (b & 1) ret = ret * a;
    a = a * a;
    b >>= 1;
  }
  return ret;
}
int main() {
  int o = 1;
  for (int i = 0; i <= 40; i++) f[1][i] = 1;
  int T = read();
  while (T--) {
    int op = read(), x = read();
    if (op == 1) {
      o++;
      fa[o] = x;
      son[x]++;
      double lst = f[x][0];
      f[x][0] = pow_mod(0.5, son[x]);
      for (int i = 0; i <= 40; i++) f[o][i] = 1;
      for (int i = 1; i <= 40; i++) {
        int u = fa[x];
        if (!u) break;
        double gg = f[u][i];
        f[u][i] /= (0.5 + 0.5 * lst);
        f[u][i] *= (0.5 + 0.5 * f[x][i - 1]);
        lst = gg;
        x = u;
      }
    } else {
      double ans = 0.0;
      for (int i = 1; i <= 40; i++) ans += (f[x][i] - f[x][i - 1]) * (double)i;
      printf("%.10lf\n", ans);
    }
  }
  return 0;
}
