#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
const int inf = 0x3f3f3f3f;
const double pi = acos(-1.0);
int n, m;
double ans;
int main() {
  int tn;
  cin >> tn;
  while (tn--) {
    int n;
    cin >> n;
    double m = n * 2;
    double a = 1.0 / cos((m - 2) * pi / (2 * m));
    if (n % 2)
      printf("%.9lf\n", a);
    else {
      printf("%.9lf\n", sqrt(a * a - 1));
    }
  }
  return 0;
}
