#include using namespace std; int main() { int n, m; cin >> n >> m; int mat[n][m]; for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { cin >> mat[i][j]; } } int x1, y1; cin >> x1 >> y1; int x2, y2; cin >> x2 >> y2; int zbir1 = 0; if(x1 - 1 >= 0) { // postoi gorniot sosed zbir1 += mat[x1 - 1][y1]; } if(x1 + 1 < n) { // postoi dolniot sosed zbir1 += mat[x1 + 1][y1]; } if(y1 - 1 >= 0) { // postoi leviot sosed zbir1 += mat[x1][y1 - 1]; } if(y1 + 1 < m) { // postoi desniot sosed zbir1 += mat[x1][y1 + 1]; } int zbir2 = 0; if(x2 - 1 >= 0) { // postoi gorniot sosed zbir2 += mat[x2 - 1][y2]; } if(x2 + 1 < n) { // postoi dolniot sosed zbir2 += mat[x2 + 1][y2]; } if(y2 - 1 >= 0) { // postoi leviot sosed zbir2 += mat[x2][y2 - 1]; } if(y2 + 1 < m) { zbir2 += mat[x2][y2 + 1]; } if(zbir1 > zbir2) { cout << "Poleto so indeks: (" << x1 << "," << y1 << ") ima pogolem zbir na sosedi" << endl; } else { cout << "Poleto so indeks: (" << x2 << "," << y2 << ") ima pogolem zbir na sosedi" << endl; } return 0; }