#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a[n][n];
int b[n][n];
int res[n][n];
//обнуляем все массивы
for(int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
a[i][j] = 0;
b[i][j] = 0;
res[i][j] = 0;
}
}
//ввод матрицы A
for(int i = 0; i < n; i++) {
for(int j = 0; i + j < n; j++) {
cin >> a[i][i+j];
}
}
//ввод матрицы B
for(int i = 0; i < n; i++) {
for(int j = 0; i + j < n; j++) {
cin >> b[i][i+j];
}
}
//перемножаем матрицы
for(int i = 0; i < n; i++) {
for(int j = 0; i + j < n; j++) {
for(int k = 0; k < n; k ++) {
res[i][i+j] += a[i][k]*b[k][i+j];
}
}
}
//выводим результат
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
cout << res[i][j] << " ";
}
cout << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7CglpbnQgbjsKCWNpbiA+PiBuOwoJaW50IGFbbl1bbl07CglpbnQgYltuXVtuXTsKCWludCByZXNbbl1bbl07CgkvL9C+0LHQvdGD0LvRj9C10Lwg0LLRgdC1INC80LDRgdGB0LjQstGLCglmb3IoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSB7CgkJZm9yIChpbnQgaiA9IDA7IGogPCBuOyBqKyspIHsKCQkJYVtpXVtqXSA9IDA7CgkJCWJbaV1bal0gPSAwOwoJCQlyZXNbaV1bal0gPSAwOwoJCX0KCX0KCS8v0LLQstC+0LQg0LzQsNGC0YDQuNGG0YsgQQoJZm9yKGludCBpID0gMDsgaSA8IG47IGkrKykgewoJCWZvcihpbnQgaiA9IDA7ICBpICsgaiA8IG47IGorKykgewoJCQljaW4gPj4gYVtpXVtpK2pdOwoJCX0KCX0KCS8v0LLQstC+0LQg0LzQsNGC0YDQuNGG0YsgQgoJZm9yKGludCBpID0gMDsgaSA8IG47IGkrKykgewoJCWZvcihpbnQgaiA9IDA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