#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:512000000")
using namespace std;
void solve();
void precalc();
clock_t start;
int testNumber = 1;
bool todo = true;
int main() {
  start = clock();
  int t = 1;
  cout.sync_with_stdio(0);
  cin.tie(0);
  precalc();
  cout.precision(10);
  cout << fixed;
  int testNum = 1;
  while (t--) {
    solve();
    ++testNumber;
  }
  return 0;
}
template <typename T>
T binpow(T q, T w, T mod) {
  if (!w) return 1 % mod;
  if (w & 1) return q * 1LL * binpow(q, w - 1, mod) % mod;
  return binpow(q * 1LL * q % mod, w / 2, mod);
}
void precalc() {}
template <typename T>
T gcd(T q, T w) {
  while (w) {
    q %= w;
    swap(q, w);
  }
  return q;
}
template <typename T>
T lcm(T q, T w) {
  return q / gcd(q, w) * w;
}
const int MAGIC = 70;
void solve() {
  int Q;
  cin >> Q;
  vector<int> p(1, -1);
  vector<vector<long double>> dp(1, vector<long double>(MAGIC, 1));
  dp[0][0] = 0;
  int n = 1;
  while (Q--) {
    int type, v;
    cin >> type >> v;
    --v;
    if (type == 1) {
      int cur = n++;
      p.push_back(v);
      dp.push_back(vector<long double>(MAGIC, 1));
      dp[cur][0] = 0;
      long double last = dp[v][1];
      dp[v][1] *= 0.5;
      cur = v;
      for (int h = 2; h < MAGIC && cur != 0; ++h) {
        int parent = p[cur];
        long double prev = dp[parent][h];
        dp[parent][h] = dp[parent][h] / (1 + last) * (1 + dp[cur][h - 1]);
        cur = parent;
        last = prev;
      }
    } else {
      long double res = 0;
      for (int i = 1; i < MAGIC; ++i) {
        res += 1 - dp[v][i];
      }
      cout << res << '\n';
    }
  }
}
