#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 7, H = 61;
int Q, n = 1;
int fat[N];
double f[N][H];
int qread() {
  int x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x;
}
int main() {
  scanf("%d", &Q);
  for (int i = 0; i < H; i++) f[1][i] = 1;
  int p, x;
  while (Q--) {
    p = qread();
    x = qread();
    if (p == 1) {
      fat[++n] = x;
      for (int i = 0; i < H; i++) f[n][i] = 1;
      double t1 = f[x][0], t2;
      f[x][0] *= 0.5;
      for (int i = 1, fa = fat[x]; i < H && fa; i++, fa = fat[x = fa]) {
        t2 = f[fa][i];
        f[fa][i] /= 0.5 + 0.5 * t1;
        f[fa][i] *= 0.5 + 0.5 * f[x][i - 1];
        t1 = t2;
      }
    } else {
      double ans = 0;
      for (int i = 1; i < H; i++) ans += (f[x][i] - f[x][i - 1]) * i;
      printf("%.6lf\n", ans);
    }
  }
  return 0;
}
