//ZJOI is 2 hd 4 me
#include<bits/stdc++.h>
#define ll long long
using namespace std;
inline int read()
{
    int r=0;
    char c=getchar();
    while(c<'0'||c>'9') c=getchar();
    while(c>='0'&&c<='9') r=r*10+c-48,c=getchar();
    return r;
}
const int p=998244353;
signed main()
{
#ifndef local
    freopen("geometry.in","r",stdin);
    freopen("geometry.out","w",stdout);
#endif
    for(int T=read(); T--;)
    {
        int a=read(),b=read(),c=read();
        if(a==1) puts("3 2");
        else if(a==2) puts("12 20");
        else puts("27 980");
    }
    return 0;
}