#include <bits/stdc++.h>
const int N = 5e5 + 5;
int n, fa[N];
double f[N][60];
inline int read() {
  int now = 0;
  register char c = getchar();
  for (; !isdigit(c); c = getchar())
    ;
  for (; isdigit(c); now = now * 10 + c - '0', c = getchar())
    ;
  return now;
}
int main() {
  n = 1;
  for (int i = 0; i < 60; ++i) f[1][i] = 1;
  for (int Q = read(), x; Q--;) {
    if (read() == 1) {
      fa[++n] = x = read();
      for (int i = 0; i < 60; ++i) f[n][i] = 1;
      double tmp1 = f[x][0], tmp2;
      f[x][0] *= 0.5;
      for (int Fa = fa[x], i = 1; Fa && i < 60; Fa = fa[x = Fa], ++i) {
        tmp2 = f[Fa][i];
        f[Fa][i] /= 0.5 + 0.5 * tmp1;
        f[Fa][i] *= 0.5 + 0.5 * f[x][i - 1];
        tmp1 = tmp2;
      }
    } else {
      x = read();
      double ans = 0;
      for (int i = 1; i < 60; ++i) ans += (f[x][i] - f[x][i - 1]) * i;
      printf("%.10lf\n", ans);
    }
  }
  return 0;
}
