#include <bits/stdc++.h>
using namespace std;
const int N = 40;
inline long long read() {
  long long w = 1, s = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    s = s * 10 + ch - '0';
    ch = getchar();
  }
  return w * s;
}
int fa[500101], cnt, Q, num[500101];
double f[501000][41], pw[500010];
int main() {
  cnt = 1;
  for (register int i = 0; i <= N; ++i) f[1][i] = 1;
  pw[0] = 1;
  for (register int i = 1; i <= 5e5; ++i) pw[i] = pw[i - 1] * 0.5;
  Q = read();
  while (Q--) {
    int opt = read();
    if (opt == 1) {
      int x = read();
      fa[++cnt] = x;
      num[x]++;
      for (register int i = 0; i <= N; ++i) f[cnt][i] = 1;
      double cur = f[x][0];
      f[x][0] = pw[num[x]];
      for (register int i = 1; i <= N; ++i) {
        int t = fa[x];
        if (!t) break;
        double o = cur;
        cur = f[t][i];
        f[t][i] /= (0.5 + 0.5 * o);
        f[t][i] *= (0.5 + 0.5 * f[x][i - 1]);
        x = t;
      }
    } else {
      double Ans = 0;
      int x = read();
      for (register int i = 1; i <= N; ++i)
        Ans += (double)i * (f[x][i] - f[x][i - 1]);
      printf("%.10lf\n", Ans);
    }
  }
  return 0;
}
