#include <iostream>
using namespace std;
int main() {
const int n = 5 ;
int a[n][n] ;
for (size_t i = 0 ; i < n ; i++){
for (size_t j = 0 ; j < n ; j++){
a[i][j] = rand() % 10 ;
cout << a[i][j] << " ";
}
cout << endl ;
}
int max = - 10 , x , y ;
for (size_t i = 0 ; i < n ; i++){
for (size_t j = 0 ; j < n ; j++){
if (( i == j ) or (i+j==n-1)){
if ( a[i][j] > max ){
max = a[i][j] ;
x = i + 1 ;
y = j + 1 ;
}
}
}
}
cout << max << " " << x << " " << y << endl ;
int p ;
p = a[n/2][n/2] ;
a[n/2][n/2] = a[x-1][y-1] ;
a[x-1][y-1] = p ;
for (size_t i = 0 ; i < n ; i++){
for (size_t j = 0 ; j < n ; j++){
cout << a[i][j] << " ";
}
cout << endl ;
}
return 0;
}