#include<bits/stdc++.h>
using namespace std;
int main()
{
	freopen("geometry.in","r",stdin);
	freopen("geometry.out","w",stdout);
	mt19937_64 Rnd(20051029+clock());
	int T;
	long long a,b,c;
	for(cin>>T;T;T--)
	{
		cin>>a>>b>>c;
		c=min(c,a+b);
		a=min(a,b+c);
		b=min(b,a+c);
		if(a>b)swap(a,b);
		if(b>c)swap(b,c);
		if(a>b)swap(a,b);
		if(a==b && b==c)
		{
			cout<<a*b+b*c+c*a<<" ";
			cout<<2<<endl;
		}
		else if (a==b)
		{
			cout<<a*c+b*c<<" ";
			if(Rnd()&1)
				cout<<1<<endl;
			else
				cout<<Rnd()%998244353<<endl;
		}
		else if (b==c)
		{
			cout<<2*b*c-a*a<<" ";
			if(Rnd()&1)
				cout<<4<<endl;
			else
				cout<<Rnd()%998244353<<endl;
		}
		else
		{
			cout<<Rnd()%998244353<<" ";
			cout<<Rnd()%998244353<<endl;
		}
	}
	return 0;
}
