#include <bits/stdc++.h>
using namespace std;
const int D = 60;
double f[500010][D + 5];
int fa[500010];
void dfs(int x, int dep, double p) {
  if (!x || dep > D) return;
  double t = f[x][dep];
  f[x][dep] *= p;
  dfs(fa[x], dep + 1, (f[x][dep] + 1) / (t + 1));
}
int main() {
  int n = 1, tt;
  for (int i = 0; i <= D; i++) f[n][i] = 1;
  scanf("%d", &tt);
  while (tt--) {
    int ty, x;
    scanf("%d%d", &ty, &x);
    if (ty == 1) {
      n++;
      fa[n] = x;
      for (int i = 0; i <= D; i++) f[n][i] = 1;
      dfs(fa[n], 0, 0.5);
    } else {
      double ans = 0;
      for (int i = 1; i <= D; i++) ans += (f[x][i] - f[x][i - 1]) * i;
      printf("%.10lf\n", ans);
    }
  }
  return 0;
}
