#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-8;
const double PI = acos(-1);
template <class T, class S>
inline void add(T& a, S b) {
  a += b;
  if (a >= mod) a -= mod;
}
template <class T, class S>
inline void sub(T& a, S b) {
  a -= b;
  if (a < 0) a += mod;
}
template <class T, class S>
inline bool chkmax(T& a, S b) {
  return a < b ? a = b, true : false;
}
template <class T, class S>
inline bool chkmin(T& a, S b) {
  return a > b ? a = b, true : false;
}
int n, q, pa[N];
int depth[N];
double dp[N][51];
int main() {
  for (int i = 1; i < N; i++)
    for (int j = 0; j <= 50; j++) dp[i][j] = 1.0;
  scanf("%d", &q);
  n++;
  while (q--) {
    int op, u;
    scanf("%d%d", &op, &u);
    if (op == 1) {
      int v = ++n;
      pa[v] = u;
      int cur = u;
      double tmp1 = dp[cur][0] * 0.5 + 0.5, tmp2;
      for (int o = 1; o < 50 && pa[cur]; o++) {
        tmp2 = dp[pa[cur]][o] * 0.5 + 0.5;
        dp[pa[cur]][o] /= tmp1;
        cur = pa[cur];
        tmp1 = tmp2;
      }
      dp[u][0] *= 0.5;
      cur = u;
      for (int o = 1; o <= 50 && pa[cur]; o++) {
        dp[pa[cur]][o] *= 0.5 + 0.5 * dp[cur][o - 1];
        cur = pa[cur];
      }
    } else {
      double ans = depth[u];
      for (int i = 1; i <= 50; i++) ans += i * (dp[u][i] - dp[u][i - 1]);
      printf("%.12f\n", ans);
    }
  }
  return 0;
}
