#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using vi = vector<ll>;
using vvi = vector<vi>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pi = pair<ll, ll>;
using ppi = pair<pi, ll>;
const int dir[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
int n, m;
vector<vector<int>> matrix;
bool is_good(int x1, int y1, int x2, int y2) {
  int diff = abs(matrix[x1][y1] - matrix[x2][y2]);
  return diff != 1 && diff != m;
}
pair<int, int> get_bad_pair(void) {
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      for (int d = 0; d < 4; ++d) {
        int x = i + dir[d][0];
        int y = j + dir[d][1];
        if (x >= 0 && x < n && y >= 0 && y < m && !is_good(i, j, x, y))
          return make_pair(i, j);
      }
    }
  }
  return make_pair(-1, -1);
}
int main(void) {
  ios_base::sync_with_stdio(0);
  srand(time(NULL));
  cin >> n >> m;
  matrix.resize(n, vector<int>(m));
  vector<int> fl(n * m);
  iota((fl).begin(), (fl).end(), 1);
  random_shuffle((fl).begin(), (fl).end());
  int k = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) matrix[i][j] = fl[k++];
  while (clock() <= 1.9 * CLOCKS_PER_SEC) {
    pair<int, int> bad = get_bad_pair();
    if (bad.first == -1) {
      cout << "YES" << endl;
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) cout << matrix[i][j] << " ";
        cout << endl;
      }
      return 0;
    }
    int newx = rand() % n;
    int newy = rand() % m;
    swap(matrix[newx][newy], matrix[bad.first][bad.second]);
  }
  {
    cerr << "vector "
         << "matrix"
         << " = ";
    cerr << endl;
    for (auto _ : matrix) {
      for (auto __ : _) cerr << __ << ' ';
      cerr << endl;
    }
  };
  cout << "NO" << endl;
  return 0;
}
