#include <bits/stdc++.h>
using namespace std;
const int N = 500004;
double dp[N][60];
int fa[N];
int tot = 1;
int main() {
  int i, j;
  double pre, last;
  int q;
  int opt, x;
  for (i = 0; i <= 50; i++) dp[1][i] = 1.0;
  scanf("%d", &q);
  while (q--) {
    scanf("%d%d", &opt, &x);
    if (opt == 1) {
      tot++;
      fa[tot] = x;
      pre = dp[x][0];
      dp[x][0] *= 0.5;
      for (i = 0; i <= 50; i++) dp[tot][i] = 1;
      for (j = 1; j <= 50 && fa[x]; j++, x = fa[x]) {
        last = dp[fa[x]][j];
        dp[fa[x]][j] = dp[fa[x]][j] / (1.0 + pre) * (1 + dp[x][j - 1]);
        pre = last;
      }
    } else {
      double ans = 0;
      for (i = 1; i <= 50; i++) ans += i * (dp[x][i] - dp[x][i - 1]);
      printf("%.10lf\n", (double)(ans));
    }
  }
  return 0;
}
