#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const int N = 1e6+10;
int t,n,m,k,l,r,op,x;
double y;
int f[N];
bool flag;
//int dp[N][N];
void solve(){
cin>>t;
while(t--){
cin>>x;
if(0<=x&&x<2){
y = -x+2.5;
}else if(x<4){
y = 2-1.5*(x-3)*(x-3);
}else if(x<6){
y = (double)x/2 -1.5;
}
printf("y=%.1f\n",y);
}
}
int main(){
solve();
return 0;
}