#include <bits/stdc++.h>
using namespace std;
int n;
double dp[500020][66];
int fa[500020], d[500020];
int main() {
  int q;
  scanf("%d", &q);
  n = 1;
  for (int i = 0; i < 66; ++i) dp[1][i] = 1;
  while (q--) {
    int t, v;
    scanf("%d%d", &t, &v);
    if (t == 1) {
      ++n;
      for (int i = 0; i < 66; ++i) dp[n][i] = 1;
      fa[n] = v;
      d[v]++;
      double pre = dp[v][0];
      dp[v][0] = pow(0.5, d[v]);
      int k = 1;
      while (fa[v] && k < 66) {
        int u = fa[v];
        double tmp = dp[u][k];
        dp[u][k] /= 0.5 + 0.5 * pre;
        dp[u][k] *= 0.5 + 0.5 * dp[v][k - 1];
        pre = tmp;
        v = u;
        ++k;
      }
    } else {
      double ans = 0;
      for (int i = 1; i < 66; ++i) ans += i * (dp[v][i] - dp[v][i - 1]);
      printf("%.12lf\n", ans);
    }
  }
  return 0;
}
