#include <bits/stdc++.h>
using namespace std;
int q, n, f[500005], p[500005];
double dp[500005][72];
int main() {
  scanf("%d", &q);
  n = 1;
  for (int i = 1; i <= 70; i++) dp[1][i] = 1.0;
  while (q--) {
    int t, x;
    scanf("%d%d", &t, &x);
    if (t == 1) {
      p[++n] = x;
      f[x]++;
      x = n;
      for (int i = 1; i <= 70; i++) dp[x][i] = 1.0;
      double o = 1.0;
      for (int i = 1; i <= 70; i++) {
        double oo = 0.5 + 0.5 * dp[p[x]][i];
        dp[p[x]][i] *= (0.5 + 0.5 * dp[x][i - 1]) / o;
        o = oo;
        x = p[x];
      }
    } else {
      double out = 0;
      for (int i = 1; i <= 70; i++) out += 1.0 - dp[x][i];
      printf("%.10lf\n", out);
    }
  }
  return 0;
}
