#include <bits/stdc++.h>
using namespace std;
inline int ReadInt() {
  static int n, ch;
  n = 0, ch = getchar();
  while (!isdigit(ch)) ch = getchar();
  while (isdigit(ch)) n = (n << 3) + (n << 1) + ch - '0', ch = getchar();
  return n;
}
const int MAX_H = 35, maxn = 500000 + 3;
double dp[maxn][MAX_H];
int n = 1, fa[maxn];
int main() {
  int q = ReadInt();
  fill(dp[0], dp[0] + MAX_H, 1.0);
  fa[0] = -1;
  while (q--) {
    int type = ReadInt(), u = ReadInt() - 1;
    if (type == 2) {
      double ans = 0;
      for (int i = 1; i < MAX_H; ++i) ans += i * (dp[u][i] - dp[u][i - 1]);
      printf("%.10lf\n", ans);
    } else if (type == 1) {
      fa[n] = u;
      int cur = n++, cnt = 0;
      double last = 1.0, pre = 0, llast;
      fill(dp[cur], dp[cur] + MAX_H, 1.0);
      while (cur != -1 && cnt < MAX_H) {
        if (cnt) {
          llast = dp[cur][cnt - 1];
          dp[cur][cnt - 1] /= (last / 2 + 0.5);
          dp[cur][cnt - 1] *= (pre / 2 + 0.5);
          pre = dp[cur][cnt - 1];
          last = llast;
        }
        cnt++;
        cur = fa[cur];
      }
    } else
      assert(false);
  }
  return 0;
}
