#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define int long long
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
return f?-x:x;
}
#define mod 998244353
struct modint{
unsigned int x;
modint(int o=0){x=o;}
modint &operator = (int o){return x=o,*this;}
modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
modint &operator -=(modint o){return x=x<o.x?x-o.x+mod:x-o.x,*this;}
modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
modint &operator ^=(int b){
modint a=*this,c=1;
for(;b;b>>=1,a*=a)if(b&1)c*=a;
return x=c.x,*this;
}
modint &operator /=(modint o){return *this *=o^=mod-2;}
friend modint operator +(modint a,modint b){return a+=b;}
friend modint operator -(modint a,modint b){return a-=b;}
friend modint operator *(modint a,modint b){return a*=b;}
friend modint operator /(modint a,modint b){return a/=b;}
friend modint operator ^(modint a,int b){return a^=b;}
friend bool operator ==(modint a,modint b){return a.x==b.x;}
friend bool operator !=(modint a,modint b){return a.x!=b.x;}
bool operator ! () {return !x;}
modint operator - () {return x?mod-x:0;}
bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}
vector<modint> fac,ifac,iv;
inline void initC(int n)
{
if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
int m=iv.size(); ++n;
if(m>=n)return;
iv.resize(n),fac.resize(n),ifac.resize(n);
For(i,m,n-1){
iv[i]=iv[mod%i]*(mod-mod/i);
fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
}
}
inline modint C(int n,int m){
if(m<0||n<m)return 0;
return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}
typedef double db;
const db eps=1e-8,pi=3.14159265358979323846;
int sgn(int x){return x<0?-1:x>0;}
int cmp(int a,int b){return sgn(a-b);}
struct P{
int x,y,id;
P(int x=0,int y=0):x(x),y(y){}
P&operator +=(P o){return x+=o.x,y+=o.y,*this;}
P&operator -=(P o){return x-=o.x,y-=o.y,*this;}
P&operator *=(int o){return x*=o,y*=o,*this;}
P&operator /=(int o){return x/=o,y/=o,*this;}
friend P operator +(P a,P b){return a+=b;}
friend P operator -(P a,P b){return a-=b;}
friend P operator *(P a,int b){return a*=b;}
friend P operator /(P a,int b){return a/=b;}
friend bool operator <(P a,P b){return fabs(a.x-b.x)<eps?a.y<b.y:a.x<b.x;}
friend bool operator ==(P a,P b){return cmp(a.x,b.x)==0 && cmp(a.y,b.y)==0;}
friend bool operator !=(P a,P b){return !(a==b);}
friend int operator %(P a,P b){return a.x*b.x+a.y*b.y;} // dot
friend int operator *(P a,P b){return a.x*b.y-a.y*b.x;} // cross
P rot90(){return P(-y,x);}
db ang(){return atan2(y,x);}
db len(){return sqrt(x*x+y*y);}
int len2(){return x*x+y*y;}
int half(){return sgn(y)==1||(sgn(y)==0&&sgn(x)<=0);}
// P unit(){return ((*this))/len();}
void read(){cin>>x>>y;}
void out(){cout<<"("<<x<<","<<y<<")"<<endl;}
};
bool cmp_dir(P a,P b){
if(a.half()!=b.half())return a.half()<b.half();
return sgn(a*b)>0;
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 200005
#define inf 0x3f3f3f3f
int n,x[maxn],y[maxn];
P p[maxn];
db ag[maxn];
struct node{
int u,v;
P w;
};
int res[maxn];
int sx[maxn],sy[maxn];
bool same(P a,P b){
return a.half() == b.half() && sgn(a*b)==0;
}
int ff[maxn];
int gf(int x){
while(x!=ff[x])x=ff[x]=ff[ff[x]];
return x;
}
vi vec[maxn];
int rk[maxn];
void work()
{
n=read();
For(i,1,n){
int xx=read(),yy=read(),zz=read();
x[i]=xx-yy;
y[i]=-xx-yy+zz*2;
p[i]=P(x[i],y[i]);
p[i].id=i;
ag[i]=p[i].ang();
}
// 1/18 * (3*x*x+y*y)
vector<node>os;
For(i,1,n) For(j,1,n) if(i!=j) {
P tmp=p[i]-p[j];
if(!tmp.x && !tmp.y) continue;
tmp=tmp.rot90();
os.pb({i,j,tmp});
}
sort(os.begin(),os.end(),[&](node a,node b){
return cmp_dir(a.w,b.w);
});
sort(p+1,p+n+1);// x
/*
For(i,1,n){
cout<<"x,y: "<<x[i]<<" "<<y[i]<<"\n";
}cout<<"--------\n";
for(auto [u,v,w]:os){
cout<<"u,v,w: "<<u<<" "<<v<<"\n";
w.out();
}
*/
auto UPD=[&](int l,int r){
For(i,l,r){
int u=p[i].id;
rk[u]=i;
// cout<<"rank "<<u<<" "<<rk[u]<<"\n";
sx[i]=sx[i-1]+x[u],sy[i]=sy[i-1]+y[u];
res[i]=max(res[i],sx[i]*sx[i]*3+sy[i]*sy[i]);
}
};
UPD(1,n);
for(int i=0;i<os.size();){
int j=i;
while(j+1<os.size() && same(os[i].w,os[j+1].w)) ++j;
// cout<<"range: "<<i<<" "<<j<<"\n";
vi nd;
For(k,i,j){
auto [u,v,w]=os[k];
nd.pb(u),nd.pb(v);
}
sort(nd.begin(),nd.end());
nd.erase(unique(nd.begin(),nd.end()),nd.end());
for(int u:nd) ff[u]=u;
For(k,i,j){
auto [u,v,w]=os[k];
ff[gf(u)]=gf(v);
}
for(int u:nd) vec[gf(u)].pb(u);
for(int u:nd) if(vec[u].size()) {
int l=inf,r=-1;
for(int v:vec[u]){
// cout<<"v: "<<v<<"\n";
l=min(l,rk[v]);
r=max(r,rk[v]);
}
assert(r-l+1==vec[u].size());
reverse(p+l,p+r+1);
UPD(l,r);
vec[u].clear();
}
i=j+1;
}
For(i,1,n){
modint out=res[i]%mod;
out/=(18ll*i%mod*i%mod);
cout<<out.x<<'\n';
}
}
/*
6
180 0 0
270 0 0
0 180 180
0 360 360
0 0 180
0 0 360
30594 32322 46262
63608 59020 98436
90150 32740 67209
82886 4627 54813
3112 67989 74995
60872 9967 9051
8 1
5 8 5 1
*/
signed main()
{
int T=1;
while(T--)work();
return 0;
}
/*#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
#define int long long
using namespace std;
inline int read()
{
char c=getchar();int x=0;bool f=0;
for(;!isdigit(c);c=getchar())f^=!(c^45);
for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
return f?-x:x;
}
#define mod 998244353
struct modint{
unsigned int x;
modint(int o=0){x=o;}
modint &operator = (int o){return x=o,*this;}
modint &operator +=(modint o){return x=x+o.x>=mod?x+o.x-mod:x+o.x,*this;}
modint &operator -=(modint o){return x=x<o.x?x-o.x+mod:x-o.x,*this;}
modint &operator *=(modint o){return x=1ll*x*o.x%mod,*this;}
modint &operator ^=(int b){
modint a=*this,c=1;
for(;b;b>>=1,a*=a)if(b&1)c*=a;
return x=c.x,*this;
}
modint &operator /=(modint o){return *this *=o^=mod-2;}
friend modint operator +(modint a,modint b){return a+=b;}
friend modint operator -(modint a,modint b){return a-=b;}
friend modint operator *(modint a,modint b){return a*=b;}
friend modint operator /(modint a,modint b){return a/=b;}
friend modint operator ^(modint a,int b){return a^=b;}
friend bool operator ==(modint a,modint b){return a.x==b.x;}
friend bool operator !=(modint a,modint b){return a.x!=b.x;}
bool operator ! () {return !x;}
modint operator - () {return x?mod-x:0;}
bool operator <(const modint&b)const{return x<b.x;}
};
inline modint qpow(modint x,int y){return x^y;}
vector<modint> fac,ifac,iv;
inline void initC(int n)
{
if(iv.empty())fac=ifac=iv=vector<modint>(2,1);
int m=iv.size(); ++n;
if(m>=n)return;
iv.resize(n),fac.resize(n),ifac.resize(n);
For(i,m,n-1){
iv[i]=iv[mod%i]*(mod-mod/i);
fac[i]=fac[i-1]*i,ifac[i]=ifac[i-1]*iv[i];
}
}
inline modint C(int n,int m){
if(m<0||n<m)return 0;
return initC(n),fac[n]*ifac[m]*ifac[n-m];
}
inline modint sign(int n){return (n&1)?(mod-1):(1);}
typedef double db;
const db eps=1e-8,pi=3.14159265358979323846;
int sgn(int x){return x<0?-1:x>0;}
int cmp(int a,int b){return sgn(a-b);}
struct P{
int x,y,id;
P(int x=0,int y=0):x(x),y(y){}
P&operator +=(P o){return x+=o.x,y+=o.y,*this;}
P&operator -=(P o){return x-=o.x,y-=o.y,*this;}
P&operator *=(int o){return x*=o,y*=o,*this;}
P&operator /=(int o){return x/=o,y/=o,*this;}
friend P operator +(P a,P b){return a+=b;}
friend P operator -(P a,P b){return a-=b;}
friend P operator *(P a,int b){return a*=b;}
friend P operator /(P a,int b){return a/=b;}
friend bool operator <(P a,P b){return fabs(a.x-b.x)<eps?a.y<b.y:a.x<b.x;}
friend bool operator ==(P a,P b){return cmp(a.x,b.x)==0 && cmp(a.y,b.y)==0;}
friend bool operator !=(P a,P b){return !(a==b);}
friend int operator %(P a,P b){return a.x*b.x+a.y*b.y;} // dot
friend int operator *(P a,P b){return a.x*b.y-a.y*b.x;} // cross
P rot90(){return P(-y,x);}
db ang(){return atan2(y,x);}
db len(){return sqrt(x*x+y*y);}
int len2(){return x*x+y*y;}
int half(){return sgn(y)==1||(sgn(y)==0&&sgn(x)<=0);}
// P unit(){return ((*this))/len();}
void read(){cin>>x>>y;}
void out(){cout<<"("<<x<<","<<y<<")"<<endl;}
};
bool cmp_dir(P a,P b){
if(a.half()!=b.half())return a.half()<b.half();
return sgn(a*b)>0;
}
#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;
#define maxn 200005
#define inf 0x3f3f3f3f
int n,x[maxn],y[maxn];
P p[maxn];
db ag[maxn];
struct node{
int u,v;
P w;
};
int res[maxn];
int sx[maxn],sy[maxn];
bool same(P a,P b){
return a.half() == b.half() && sgn(a*b)==0;
}
int ff[maxn];
int gf(int x){
while(x!=ff[x])x=ff[x]=ff[ff[x]];
return x;
}
vi vec[maxn];
int rk[maxn];
void work()
{
n=read();
For(i,1,n){
int xx=read(),yy=read(),zz=read();
x[i]=xx-yy;
y[i]=-xx-yy+zz*2;
p[i]=P(x[i],y[i]);
p[i].id=i;
ag[i]=p[i].ang();
}
// 1/18 * (3*x*x+y*y)
vector<node>os;
For(i,1,n) For(j,1,n) if(i!=j) {
P tmp=p[i]-p[j];
if(!tmp.x && !tmp.y) continue;
tmp=tmp.rot90();
os.pb({i,j,tmp});
}
sort(os.begin(),os.end(),[&](node a,node b){
return cmp_dir(a.w,b.w);
});
sort(p+1,p+n+1);// x
/*
For(i,1,n){
cout<<"x,y: "<<x[i]<<" "<<y[i]<<"\n";
}cout<<"--------\n";
for(auto [u,v,w]:os){
cout<<"u,v,w: "<<u<<" "<<v<<"\n";
w.out();
}
*/
auto UPD=[&](int l,int r){
63608 59020 98436
90150 32740 67209
82886 4627 54813
3112 67989 74995
60872 9967 9051
8 1
5 8 5 1
*/
signed main()
{
int T=1;
while(T--)work();
return 0;
}*/