#include <bits/stdc++.h>
const int N = 50;
const int M = 500005;
int read() {
  int x = 0, flag = 1;
  char c;
  while ((c = getchar()) < '0' || c > '9')
    if (c == '-') flag = -1;
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x * flag;
}
int n, m, k, t, fa[M], q[M];
double dp[M][N];
void add(int x, int y) {
  t = 0;
  for (int i = 0; i < N; i++) dp[x][i] = 1;
  for (int i = 1, k = y; i < N && k; i++, k = fa[k]) q[++t] = k;
  for (int i = t; i > 1; i--) {
    int u = q[i], v = q[i - 1];
    for (int j = 1; j < N; j++) dp[u][j] /= 0.5 * (dp[v][j - 1] + 1);
  }
  dp[y][0] *= 0.5;
  for (int i = 1; i < t; i++) {
    int u = q[i + 1], v = q[i];
    for (int j = 1; j < N; j++) dp[u][j] *= 0.5 * (dp[v][j - 1] + 1);
  }
}
double ask(int x) {
  double r = 0;
  for (int i = 1; i < N; i++) r += (dp[x][i] - dp[x][i - 1]) * i;
  return r;
}
signed main() {
  n = read();
  m++;
  for (int i = 0; i < N; i++) dp[m][i] = 1;
  while (n--) {
    int op = read(), x = read();
    if (op == 1) {
      m++;
      add(m, fa[m] = x);
    }
    if (op == 2) printf("%.10lf\n", ask(x));
  }
}
