#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  return x * f;
}
const int N = 500005;
const int H = 60;
double f[N][H + 2];
int fa[N], n = 1;
void add(int x) {
  fa[++n] = x;
  for (int i = 0; i <= H; ++i) f[n][i] = 1;
  double t1 = f[x][0], t2;
  f[x][0] *= 0.5;
  for (int i = 1; i <= H; ++i, x = fa[x]) {
    int p = fa[x];
    if (!p) break;
    t2 = f[p][i];
    f[p][i] = f[p][i] / (0.5 + 0.5 * t1);
    f[p][i] = f[p][i] * (0.5 + 0.5 * f[x][i - 1]);
    t1 = t2;
  }
}
void query(int x) {
  double ans = 0;
  for (int i = 1; i <= H; ++i) ans += i * (f[x][i] - f[x][i - 1]);
  printf("%.10lf\n", ans);
}
int main() {
  int Q = read();
  for (int i = 0; i <= H; ++i) f[1][i] = 1;
  while (Q--) {
    int opt = read(), a = read();
    if (opt == 1)
      add(a);
    else
      query(a);
  }
  return 0;
}
