#include <bits/stdc++.h>
inline int read() {
  register int x = 0;
  register int f = 1;
  register char c;
  while (!isdigit(c = getchar()))
    if (c == '-') f = -1;
  while (x = (x << 1) + (x << 3) + (c xor 48), isdigit(c = getchar()))
    ;
  return x * f;
}
template <class T>
inline void write(T x) {
  static char stk[30];
  static int top = 0;
  if (x < 0) {
    x = -x, putchar('-');
  }
  while (stk[++top] = x % 10 xor 48, x /= 10, x)
    ;
  while (putchar(stk[top--]), top)
    ;
}
template <typename T>
inline bool chkmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
using namespace std;
const int maxN = 5e5 + 1;
const int D = 50;
int Q, fa[maxN], ncnt;
double dp[maxN][D];
void clear(int x, int son, int cnt) {
  if (!x || cnt >= D) return;
  clear(fa[x], x, cnt + 1);
  for (int i = 1; i < D; ++i) dp[x][i] /= 0.5 * (dp[son][i - 1] + 1);
}
void update(int x, int son, int cnt) {
  if (!x || cnt >= D) return;
  for (int i = 1; i < D; ++i) dp[x][i] *= 0.5 * (dp[son][i - 1] + 1);
  update(fa[x], x, cnt + 1);
}
double ask(int x) {
  double ans(0);
  for (int i = 1; i < D; ++i) ans += (double)i * (dp[x][i] - dp[x][i - 1]);
  return ans;
}
int main() {
  Q = read();
  ncnt = 1;
  fa[1] = 0;
  fill(dp[1], dp[1] + D, 1);
  while (Q--) {
    int op = read(), x = read();
    if (op == 1) {
      fa[++ncnt] = x;
      clear(fa[x], x, 1);
      fill(dp[ncnt], dp[ncnt] + D, 1);
      dp[x][0] *= 0.5;
      update(x, ncnt, 0);
    } else {
      printf("%.7lf\n", ask(x));
    }
  }
  return 0;
}
