#include <iostream>
#include <vector>
#include <random>
#include <algorithm>

constexpr int N = 2000005;
constexpr int p = 998244353;
constexpr int inv2 = (p + 1) >> 1;

int add(int x, int y) { return (x += y) >= p ? x - p : x; }
int mul(int x, int y) { return static_cast<unsigned long long>(x) * y % p; }

int n;
int a[N], b[N];

int main() {
    std::ios::sync_with_stdio(false), std::cin.tie(nullptr);
    std::cin >> n;
    std::mt19937 rand;
    for (int i = 0; i < n; ++i) {
        a[i] = rand() % p;
        std::cout << a[i] << ' ';
    }
    std::cout << std::endl;
    while (1) {
        for (int j = 0; j < n >> 1; ++j) b[j] = add(a[j], a[n - 1 - j]);
        for (int j = 0, k = 0; j < n; j += 2, ++k) a[j] = a[j + 1] = mul(b[k], inv2);
        for (int i = 0; i < n; ++i) std::cout << a[i] << ' ';
        std::cout << std::endl;
    }
    return 0;
}
