#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 10;
const int H = 60;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
int q, opt, x, fa[N], tot = 1;
double dp[N][H + 5];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  for (int i = 1; i <= H; i++) dp[1][i] = 1;
  cin >> q;
  while (q--) {
    cin >> opt >> x;
    if (opt == 1) {
      vector<int> v;
      fa[++tot] = x, x = tot;
      for (int i = 1; i <= H; i++) dp[x][i] = 1;
      for (int i = 1; i <= H + 1 && x; i++) v.push_back(x), x = fa[x];
      int sz = (int)v.size();
      for (int i = sz - 2; i > 0; i--)
        dp[v[i + 1]][i + 1] /= (dp[v[i]][i] + 1) / 2.0;
      for (int i = 0; i < sz - 1; i++)
        dp[v[i + 1]][i + 1] *= (dp[v[i]][i] + 1) / 2.0;
      continue;
    }
    double ans = H - 1;
    for (int i = 1; i < H; i++) ans -= dp[x][i];
    cout << fixed << setprecision(10) << ans << "\n";
  }
  return 0;
}
