#include <bits/stdc++.h>
using namespace std;

double f(double x){
    double res = 0;
    if(0<=x && x<2){
        res = -x+2.5;
    }else if(2<=x && x<4){
        res = 2-1.5*pow(x-3,2);
    }else if(4<=x && x<6){
        res = x/2-1.5;
    }
    return res;
}

int main() {
    int n;
    double x;
    cin>>n;
    while(n--){
        cin>>x;
        cout<<"y="<<fixed<<setprecision(1)<<f(x)<<endl;
    }
}
// 64 位输出请用 printf("%lld")

qd