#include <bits/stdc++.h>
using namespace std;
const int MH = 60;
double dp[500010][67];
int fa[500010];
int n = 1;
int s[110], head;
void add(int f) {
  n++;
  for (int i = 0; i <= MH; i++) dp[n][i] = 1;
  head = 0;
  int now = n;
  fa[n] = f;
  for (int i = 0; i <= MH && now; i++, now = fa[now]) s[++head] = now;
  for (int i = head - 1; i > 1; i--)
    dp[s[i + 1]][i - 1] /= (dp[s[i]][i - 2] + 1) / 2;
  dp[s[2]][0] *= 1.0 / 2;
  for (int i = 2; i < head; i++)
    dp[s[i + 1]][i - 1] *= (dp[s[i]][i - 2] + 1) / 2;
  return;
}
double query(int x) {
  double ans = 0;
  for (int i = 0; i <= MH; i++) ans += (1 - dp[x][i]);
  return ans;
}
int main() {
  int q;
  scanf("%d", &q);
  for (int i = 0; i <= MH; i++) dp[n][i] = 1;
  for (int i = 1; i <= q; i++) {
    int opt, u;
    scanf("%d %d", &opt, &u);
    if (opt == 1)
      add(u);
    else
      printf("%.9lf\n", query(u));
  }
  return 0;
}
