func_code_string: #include <bits/stdc++.h>   using namespace std;   int n, m;   int pos[100010];   int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};   bool check(int i, int j) {     int x = (i - 1) / m + 1, y = (i - 1) % m + 1;     int x2 = (j - 1) / m + 1, y2 = (j - 1) % m + 1;     for (int k = 0; k < 4; k++)       if (x + dx[k] == x2 && y + dy[k] == y2) return true;     return false;   }   bool dfs(int i) {     if (i == n * m + 1) return true;     int x = (i - 1) / m + 1, y = (i - 1) % m + 1;     for (int j = i; j <= n * m; j++) {       swap(pos[i], pos[j]);       if (x != 1 && check(pos[i], pos[(x - 2) * m + y])) continue;       if (y != 1 && check(pos[i], pos[(x - 1) * m + y - 1])) continue;       if (dfs(i + 1)) return true;       swap(pos[i], pos[j]);     }     return false;   }   int main() {     scanf( %d%d , &n, &m);     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) pos[(i - 1) * m + j] = (i - 1) * m + j;     if (!dfs(1)) {       puts( NO );       return 0;     }     puts( YES );     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) printf( %d  , pos[(i - 1) * m + j]);       putchar(  n );     }     return 0;   }   