#include <bits/stdc++.h>
using namespace std;
const int ma = 40;
int Q;
int n;
int fa[500500];
double dp[500500][55];
void fix(int x) {
  int f = fa[x];
  for (int i = 0; i <= ma; ++i) dp[x][i] = 1;
  double la = dp[f][0], tmp;
  dp[f][0] *= 0.5;
  x = f;
  for (int i = 1; i <= ma && fa[x]; ++i, x = fa[x]) {
    f = fa[x];
    tmp = la;
    la = dp[f][i];
    dp[f][i] /= (0.5 * tmp + 0.5);
    dp[f][i] *= (0.5 * dp[x][i - 1] + 0.5);
  }
}
int main() {
  n = 1;
  for (int i = 0; i <= ma; ++i) dp[1][i] = 1;
  scanf("%d", &Q);
  int sym, xx;
  while (Q--) {
    scanf("%d%d", &sym, &xx);
    if (sym == 1) {
      n++;
      fa[n] = xx;
      fix(n);
    } else {
      double ans = 0;
      for (int i = 1; i <= ma; ++i) ans += (dp[xx][i] - dp[xx][i - 1]) * i;
      printf("%.8lf\n", ans);
    }
  }
  return 0;
}
