func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m, dx[] = {0, 0, -1, 1}, dy[] = {1, -1, 0, 0}, mp[100005], b;   int cheak(int x, int y) {     if (abs(x - y) == m || abs(x - y) == 1)       return 1;     else       return 0;   }   void dfs(int x) {     if (x == n * m) {       b = 1;       cout <<  YES  << endl;       for (int i = 0; i < n; i++) {         for (int j = 0; j < m; j++) printf( %d  , mp[i * m + j] + 1);         printf(  n );       }       return;     }     for (int i = x; i < n * m; i++) {       swap(mp[i], mp[x]);       if ((x / m == 0 || cheak(mp[x], mp[(x / m - 1) * m + x % m]) == 0) &&           (x % m == 0 || cheak(mp[x], mp[x / m * m + x % m - 1]) == 0)) {         dfs(x + 1);         if (b == 1) return;         swap(mp[i], mp[x]);       }     }   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 0; i < n * m; i++) mp[i] = i;     dfs(0);     if (b == 0) printf( NO );     return 0;   }   