#include <bits/stdc++.h>
using namespace std;
const int MAGIC = 61;
double dp[500100][MAGIC];
int par[500100];
int main() {
  int q;
  scanf("%d", &q);
  int tot = 1;
  for (int i = (0); i < (MAGIC); ++i) dp[1][i] = 1;
  for (int i = (0); i < (q); ++i) {
    int ty, v;
    scanf("%d%d", &ty, &v);
    if (ty == 1) {
      tot++;
      for (int j = (0); j < (MAGIC); ++j) dp[tot][j] = 1;
      par[tot] = v;
      double old = dp[v][0];
      dp[v][0] *= 0.5;
      int cur = 0;
      double neDp = dp[v][0];
      while (1) {
        v = par[v];
        cur++;
        if ((cur >= MAGIC) || (v == 0)) {
          break;
        }
        double nold = dp[v][cur];
        dp[v][cur] /= (0.5 + 0.5 * old);
        dp[v][cur] *= (0.5 + 0.5 * neDp);
        old = nold;
        neDp = dp[v][cur];
      }
    } else {
      double res = 0;
      for (int j = MAGIC - 1; j > 0; --j) {
        res += j * (dp[v][j] - dp[v][j - 1]);
      }
      printf("%.15lf\n", res);
    }
  }
  return 0;
}
