#include <bits/stdc++.h>
using namespace std;
int n, m;
int v[100005];
int a[100005];
int xpos[4] = {1, 0, 0, -1};
int ypos[4] = {0, 1, -1, 0};
bool judge(int numa, int numb) {
  int xa = numa / m;
  int ya = numa % m;
  int xb = numb / m;
  int yb = numb % m;
  for (int i = 0; i < 4; i++) {
    if (xa + xpos[i] == xb && ya + ypos[i] == yb) return true;
  }
  return false;
}
bool dfs(int i) {
  if (i == n * m) return true;
  int x = i / m;
  int y = i % m;
  for (int j = i; j < n * m; j++) {
    swap(a[i], a[j]);
    if (y && judge(a[i], a[x * m + y - 1])) continue;
    if (x && judge(a[i], a[(x - 1) * m + y])) continue;
    if (dfs(i + 1)) return true;
    swap(a[i], a[j]);
  }
  return false;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n * m; i++) a[i] = i;
  if (dfs(0)) {
    cout << "YES" << endl;
    for (int i = 0; i < n * m; i++) {
      cout << a[i] + 1;
      if ((i + 1) % m == 0)
        cout << endl;
      else
        cout << " ";
    }
  } else
    cout << "NO" << endl;
  return 0;
}
