#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  char ch = getchar();
  long long s = 0, w = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return s * w;
}
inline int lowbit(int x) { return x & (-x); }
int q, tot = 1, fa[500010], D = 60;
double f[500010][71];
int main() {
  q = read();
  for (register int i = 1; i <= D; i++) f[1][i] = 1;
  while (q--) {
    int op = read(), x = read();
    if (op == 1) {
      vector<int> v;
      fa[++tot] = x, x = tot;
      for (register int i = 1; i <= D; i++) f[x][i] = 1;
      for (register int i = 1; i <= D + 1 && x; i++) v.push_back(x), x = fa[x];
      int tmp = v.size();
      for (register int i = tmp - 2; i >= 1; i--)
        f[v[i + 1]][i + 1] /= (f[v[i]][i] + 1.0) / 2.0;
      for (register int i = 0; i <= tmp - 2; i++)
        f[v[i + 1]][i + 1] *= (f[v[i]][i] + 1.0) / 2.0;
    } else {
      double ans = D - 1;
      for (register int i = 1; i <= D - 1; i++) ans -= f[x][i];
      printf("%.10lf\n", ans);
    }
  }
  return 0;
}
