#55416: ans


yp11451032@yphs.tp.edu.tw (811-23吳嘉恩)


#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    while(cin>>n){
    double sumY=0,x,y,z,avg;
        for(int i=0;i<n*n;i++){
            int r,g,b;
            cin>>r>>g>>b;
            x=0.5149*r+0.3244*g+0.1607*b;
            y=0.2654*r+0.6704*g+0.0642*b;  //帶公式
            z=0.0248*r+0.1248*g+0.8504*b;
            sumY+=y;
            cout<<fixed<<setprecision(4)<<x<<' '<<y<<' '<<z<<'\n';
        }
    avg=sumY/(n*n);  //取平均
    cout<<fixed<<setprecision(4)<<"The average of Y is "<<avg<<'\n';
    }
}