#include<bits/stdc++.h>
using namespace std;
int c, n;
int gcd(int a, int b){
return b == 0 ? a : gcd(b, a % b);
}
int main( )
{
cin >> c;
for (int i = 1; i <= c; i++) {
cin >> n;
int ans = 0;
for (int j = 1; j <= n; j++) {
for (int k = 1; k <= n; k++) {
if (gcd(j, k) == 1)
ans++;
}
}
cout << i << " " << n << " " << ans + 2 << endl;
}
return 0;
}