#include <iostream>
#include <cstdio>
#define ll long long
using namespace std;
const ll p = 998244353;
const ll inv2 = 499122177;
int n; ll a[100];
int main(){
	freopen("test.in", "r", stdin);
	freopen("test2.out", "w", stdout);
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){
		int x; scanf("%d", &x);
		a[i] = x;
	}
	for(int i = 1; i <= n; i++)
		printf("%-12ld", a[i]);
	printf("\n");
	for(int r = 1; r <= n*n; r++){
		for(int i = 1; i <= n; i++)
			a[i] += a[n-i+1];
		for(int i = n; i >= 1; i--)
			a[i] = a[(i+1)/2] * inv2 % p;
		for(int i = 1; i <= n; i++)
			printf("%-12ld", a[i]);
		printf("\n");
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}
