#include <iostream> #include <cstdio> #include <vector> #include <cstring> #include <cmath> #include <ctime> using namespace std; #define N 500020 #define T 66 #define eps 1e-8 int n; double dp[N][T]; int fa[N], d[N]; int main() { int q; scanf("%d", &q); n = 1; for(int i = 0; i < T; ++i) dp[1][i] = 1; while(q--) { int t, v; scanf("%d%d", &t, &v); if(t == 1) { ++n; for(int i = 0; i < T; ++i) dp[n][i] = 1; fa[n] = v; d[v]++; double pre = dp[v][0]; dp[v][0] = pow(0.5, d[v]); int k = 1; while(fa[v] && k < T) { int u = fa[v]; double tmp = dp[u][k]; dp[u][k] /= 0.5 + 0.5 * pre; dp[u][k] *= 0.5 + 0.5 * dp[v][k-1]; pre = tmp; v = u; ++k; } } else { double ans = 0; for(int i = 1; i < T; ++i) ans += i * (dp[v][i] - dp[v][i-1]); printf("%.12lf\n", ans); } } return 0; }