#include using namespace std; using ll = long long; constexpr ll MOD = 1000000007LL; ll power(const ll p, const ll n) { if (n == 0) return 1; if (n % 2 == 1) { return power(p, n - 1) * p % MOD; } else { const ll pp = power(p, n / 2); return pp * pp % MOD; } } inline ll solve1(const ll N) { return N * N; } inline ll solve2(const ll N) { return N * N * N + N * N - N; } inline ll solve3(const ll T) { return T; } inline ll solve4(const ll N) { return 4 * N * N + 17; } inline ll solve5(const ll N) { return power(N, N * N * N); } inline ll solve6(const ll N) { return N; } inline ll solve7(const ll N) { return 0; } int main() { int T; cin >> T; for (int t = 0; t < T; t++) { ll N; cin >> N; cout << solve1(N) << endl; cout << solve2(N) << endl; cout << solve3(T) << endl; cout << solve4(N) << endl; cout << solve5(N) << endl; cout << solve6(N) << endl; cout << solve7(N) << endl; cout << endl; } return 0; }