#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5, K = 40;
int n, fa[N];
double f[N][K];
void Modify(int u, int v) {
  fa[v] = u;
  fill(f[v], f[v] + K, 1);
  double last = 0.5 * (1 + f[u][0]), t;
  f[u][0] *= 0.5;
  v = u;
  u = fa[u];
  for (int i = 1; i < 40 && u; i++, v = u, u = fa[u]) {
    t = 0.5 * (1 + f[u][i]);
    f[u][i] = f[u][i] / last * 0.5 * (1 + f[v][i - 1]);
    last = t;
  }
}
double Query(int u) {
  double ans = 0;
  for (int i = 1; i < 40; i++) ans += (f[u][i] - f[u][i - 1]) * i;
  return ans;
}
void Init() {
  scanf("%d", &n);
  fill(f[1], f[1] + K, 1);
}
int main() {
  Init();
  for (int i = 1, opt, x, num = 1; i <= n; i++) {
    scanf("%d%d", &opt, &x);
    switch (opt) {
      case 1:
        Modify(x, ++num);
        break;
      case 2:
        printf("%.10f\n", Query(x));
        break;
    }
  }
  return 0;
}
