#include <bits/stdc++.h>
using namespace std;
const int N = 510;
const long long MOD = 998244353;
void reduce(long long &x){x = x >= MOD ? x - MOD : x;}
struct matrix
{
	int n;
	long long a[N][N];
	void clear(){memset(a, 0, sizeof(a));}
	matrix operator *(const matrix &x)
	{
		matrix re; re.clear();
		for (int i = 1; i <= n; ++ i)
		for (int j = 1; j <= n; ++ j)
		for (int k = 1; k <= n; ++ k)
		reduce(re.a[i][j] += a[i][k] * x.a[k][j] % MOD);
		return re;
	}
};
int main()
{
	freopen("1.txt", "w", stdout);
	ios::sync_with_stdio(0); cin.tie(0);
	int n = 18 ; matrix now, pri; now.clear();
	for (int i = 1; i <= n; i += 2)
	now.a[i][(i + 1) / 2] = now.a[i][n - i / 2] = 1; 
	for (int i = 2; i <= n; i += 2)
	for (int j = 1; j <= n; ++ j)
	now.a[i][j] = now.a[i - 1][j]; now.n = n;
	pri = now;
	for (int i = 1; i <= n * 2; ++ i)
	{
		for (int i = 1; i <= n; ++ i)
		{
			for (int j = 1; j <= n; ++ j) cout << pri.a[i][j] - pri.a[i][5] << " ";
			cout << "\n";
		}
			cout << "\n";
		pri = now * pri;
	}
	
}
