#include <bits/stdc++.h>
using namespace std;
double dp[500000 + 5][55];
int cnt, fa[500000 + 5];
int newnode() {
  cnt++;
  for (int i = 0; i <= 50; i++) dp[cnt][i] = 1;
  return cnt;
}
int main() {
  int Q;
  scanf("%d", &Q);
  newnode();
  while (Q--) {
    int op, v;
    scanf("%d%d", &op, &v);
    if (op == 1) {
      int now = newnode();
      fa[now] = v;
      double o1 = 1, n1 = 0;
      for (int i = 0, now = v; now && i <= 50; i++, now = fa[now]) {
        double o2 = dp[now][i];
        dp[now][i] *= (n1 + 1) / (o1 + 1);
        o1 = o2, n1 = dp[now][i];
      }
    } else {
      double ans = 0;
      for (int i = 1; i <= 50; i++) ans += i * (dp[v][i] - dp[v][i - 1]);
      printf("%.10f\n", ans);
    }
  }
  return 0;
}
