#include <bits/stdc++.h>
using namespace std;
const long long N = 5e5 + 5, M = 65;
long long n, q, d = 60, fa[N], opt, x, s[M];
double f[N][M];
void update(long long v) {
  long long top = 0, x = v;
  for (long long i = 0; i <= d; i++) {
    if (!x) break;
    s[top++] = x, x = fa[x];
  }
  top--;
  for (long long i = top; i >= 2; i--)
    f[s[i]][i] /= 0.5 * (1 + f[s[i - 1]][i - 1]);
  for (long long i = 1; i <= d; i++) f[v][i] = 1;
  for (long long i = 1; i <= top; i++)
    f[s[i]][i] *= 0.5 * (1 + f[s[i - 1]][i - 1]);
}
double query(long long v) {
  double ans = 0;
  for (long long i = 1; i < d; i++) ans += i * (f[v][i + 1] - f[v][i]);
  return ans;
}
signed main() {
  scanf("%lld", &q), n = 1;
  for (long long i = 1; i <= d; i++) f[1][i] = 1;
  while (q--) {
    scanf("%lld%lld", &opt, &x);
    if (opt == 1)
      n++, fa[n] = x, update(n);
    else
      printf("%.10lf\n", query(x));
  }
  return 0;
}
