#include <bits/stdc++.h>
using namespace std;
typedef int *intp;
int m, n;
intp *a;
bool transposed;
void initialize() {
  if (n > m) swap(n, m), transposed = true;
  a = new intp[n];
  for (int k = 0, i = 0; i < n; i++) {
    a[i] = new int[m];
    for (int j = 0; j < m; j++) a[i][j] = k++;
  }
}
inline void set_columns(int j, int i, int p, int s) {
  while (i < s) a[j][i++] = p++, p++;
}
inline void set_r_columns(int j, int i, int p, int s) {
  while (i >= s) a[j][i--] = p++, p++;
}
inline void set_columns() {
  for (int k = 0, q = m / 2, r = m % 2, s = q + r, j = 0; j < n; j++, k += m)
    if (j % 2) {
      if (r)
        set_columns(j, 0, k, s), set_columns(j, s, k + 1, m);
      else
        set_r_columns(j, s - 1, k, 0), set_r_columns(j, m - 1, k + 1, s);
    } else
      set_columns(j, 0, k + 1, q), set_columns(j, q, k, m);
}
void shift_rows(int p) {
  int q = p - 1;
  for (int i = 0; i < n; i += 2) {
    int a0 = a[i][q], a1 = a[i][p];
    for (int j = p, k = q - 1; k >= 0; j--, k--) a[i][j] = a[i][k];
    a[i][0] = a0, a[i][1] = a1;
  }
}
void shift_columns(int p) {
  for (int j = 0; j < m; j += 2) {
    int a0 = a[0][j];
    for (int i = 0, k = 1; k < n; i++, k++) a[i][j] = a[k][j];
    a[p][j] = a0;
  }
}
void shuffle() {
  if (m > 3) {
    if (n < 3)
      set_columns();
    else
      shift_rows(m - 1), shift_columns(n - 1);
  } else if (m == 3 && n == 3)
    a[0][0] = 5, a[0][1] = 0, a[0][2] = 7, a[1][0] = 6, a[1][1] = 4,
    a[1][2] = 2, a[2][0] = 1, a[2][1] = 8, a[2][2] = 3;
}
inline int student(int i, int j) {
  int p = (transposed ? a[j][i] : a[i][j]);
  return (transposed ? (p % n) * m + p / n : p) + 1;
}
void write_output() {
  putchar('\n');
  if (transposed) swap(m, n);
  for (int i = 0; i < n; i++, putchar('\n'))
    for (int j = 0; j < m; j++) printf("%i ", student(i, j));
}
int main() {
  scanf("%i %i", &n, &m), initialize(), shuffle();
  if (m > 3 || (m == 1 && n == 1) || (m == 3 && n == 3))
    printf("YES"), write_output();
  else
    printf("NO");
}
