#include <bits/stdc++.h>
using namespace std;
bool check(int_fast64_t n, int_fast64_t m,
           vector<vector<int_fast64_t> > const& a) {
  auto valid = [n, m](int_fast64_t i, int_fast64_t j) {
    return 0 <= i && i < n && 0 <= j && j < m;
  };
  auto isnb = [n, m](int_fast64_t x, int_fast64_t y) {
    return (x / m == y / m && abs(x % m - y % m) == 1) || abs(x - y) == m;
  };
  for (int_fast64_t i = 0; i < n; ++i)
    for (int_fast64_t j = 0; j < m; ++j) {
      if ((valid(i - 1, j) && isnb(a[i - 1][j], a[i][j])) ||
          (valid(i + 1, j) && isnb(a[i + 1][j], a[i][j])) ||
          (valid(i, j - 1) && isnb(a[i][j - 1], a[i][j])) ||
          (valid(i, j + 1) && isnb(a[i][j + 1], a[i][j])))
        return false;
    }
  return true;
}
vector<vector<int_fast64_t> > solve(int_fast64_t n, int_fast64_t m) {
  if (n * m < 10) {
    vector<int_fast64_t> perm(n * m);
    iota(perm.begin(), perm.end(), 0);
    vector<vector<int_fast64_t> > test(n, vector<int_fast64_t>(m));
    do {
      for (int_fast64_t i = 0; i < n; ++i)
        for (int_fast64_t j = 0; j < m; ++j) test[i][j] = perm[i * m + j];
      if (check(n, m, test)) return test;
    } while (next_permutation(perm.begin(), perm.end()));
    return {};
  }
  if (n == 1 && m < 4) return {};
  if (n == 1) {
    vector<int_fast64_t> row;
    for (int_fast64_t i = 1; i < m; i += 2) row.push_back(i);
    for (int_fast64_t i = 0; i < m; i += 2) row.push_back(i);
    return vector<vector<int_fast64_t> >(1, row);
  }
  assert(n == 2 ? m >= 4 : true);
  int_fast64_t offset = n == 2 ? 2 : 1;
  vector<int_fast64_t> fillnext(m);
  for (int_fast64_t i = 0; i < m; ++i) fillnext[i] = i % n;
  vector<vector<int_fast64_t> > ans(n, vector<int_fast64_t>(m));
  int_fast64_t i = 0;
  for (int_fast64_t x = 0; x < n * m; ++x) {
    if (x % m == 0) {
      i = (offset * (x / m)) % m;
    }
    assert(ans[fillnext[i]][i] == 0);
    ans[fillnext[i]][i] = x;
    fillnext[i] = (fillnext[i] + 1) % n;
    i = (i + 1) % m;
  }
  return ans;
}
int_fast64_t fliplabel(int_fast64_t n, int_fast64_t m, int_fast64_t value) {
  int_fast64_t x = value % m;
  int_fast64_t y = value / m;
  return x * n + y;
}
signed main() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr);
  int_fast64_t n, m;
  cin >> n >> m;
  bool flipme = false;
  if (n > m) {
    swap(n, m);
    flipme = true;
  }
  auto solution = solve(n, m);
  if (flipme && !solution.empty()) {
    vector<vector<int_fast64_t> > a(m);
    for (auto& row : solution) {
      for (size_t i = 0; i < a.size(); ++i)
        a[i].push_back(fliplabel(n, m, row[i]));
    }
    solution = move(a);
    swap(n, m);
  }
  if (solution.empty()) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  for (auto& row : solution) {
    for (auto x : row) cout << x + 1 << ' ';
    cout << '\n';
  }
  cout << flush;
  assert(check(n, m, solution));
}
