#include <iostream>
#include <fstream>
using namespace std;
//const int n = 5;
void wypisz(int **A, int n){
for(int i = 0; i < n; i++){
for (int j = 0; j < n; j++){
cout<<A[i][j]<<" ";
}
cout << endl;
}
}
int max_suma(int **A, int n){
int w = 0, k = 0, suma = A[0][0];
cout<<A[0][0]<<" ";
for(int i = 1; i < 2*n - 1; i++){
if(A[w+1][k] > A[w][k+1]){
suma += A[w+1][k];
cout << A[w+1][k] << " ";
w++;
} else {
suma += A[w][k+1];
cout << A[w][k+1] << " ";
k++;
}
}
return suma;
}
void wczytaj(int **A, int n, fstream &wejscie){
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
wejscie>>A[i][j];
}
}
}
void nullifyEnds(int **A, int n){
for(int i = 0; i < n; i++){
A[i][n] = 0;
A[n][i] = 0;
}
}
void wczytajLepsze(int **A, int n, fstream &wejscie){
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
wejscie >> A[i][j];
}
}
}
void nullifyStart(int **A, int n){
for(int i = 0; i < n; i++){
A[0][i] = 0;
A[i][0] = 0;
}
}
int main()
{
fstream wej;
wej.open("dane.txt", ios::in);
int n;
wej >> n;
cout << n << endl;
int **A = new int *[n+1];
for(int i = 0; i <= n; i++){
A[i] = new int[n+1];
}
wczytajLepsze(A,n,wej);
nullifyStart(A, n + 1);
//wypisz(A, n);
wypisz(A, n+1);
cout << endl;
//cout<<"\n"<<max_suma(A, n);
wej.close();
return 0;
}