#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int add(int a, int b) {
  long long x = a + b;
  if (x >= 1000000007) x -= 1000000007;
  if (x < 0) x += 1000000007;
  return x;
}
long long mul(long long a, long long b) { return (a * b) % 1000000007; }
long long pw(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % 1000000007;
    a = (a * a) % 1000000007;
    b >>= 1;
  }
  return ans;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
long long rand_seed() {
  long long a = rng();
  return a;
}
int n, m, v[15], mat[15][15];
void bruteforce() {
  for (int i = 1; i <= n * m; ++i) v[i] = i;
  do {
    int l = 1, c = 1;
    for (int i = 1; i <= n * m; ++i) {
      mat[l][c] = v[i];
      ++c;
      if (c > m) c = 1, ++l;
    }
    bool ok = 1;
    for (int i = 1; i <= n; ++i)
      for (int j = 1; j <= m; ++j) {
        if (i + 1 <= n && (abs(mat[i][j] - mat[i + 1][j]) == 1 ||
                           abs(mat[i][j] - mat[i + 1][j]) == m))
          ok = 0;
        if (j + 1 <= m && (abs(mat[i][j] - mat[i][j + 1]) == 1 ||
                           abs(mat[i][j] - mat[i][j + 1]) == m))
          ok = 0;
      }
    if (ok) {
      for (int i = 1; i <= n; cout << '\n', ++i)
        for (int j = 1; j <= m; ++j) cout << mat[i][j] << " ";
      break;
    }
  } while (next_permutation(v + 1, v + n * m + 1));
}
void solveone(int linie) {
  if (m == 4)
    cout << (linie - 1) * m + 2 << " " << (linie - 1) * m + 4 << " "
         << (linie - 1) * m + 1 << " " << (linie - 1) * m + 3 << '\n';
  else {
    int x = 1;
    while (x <= m) cout << (linie - 1) * m + x << " ", x += 2;
    x = 2;
    while (x <= m) cout << (linie - 1) * m + x << " ", x += 2;
    cout << '\n';
  }
}
void solvetwo(int liniea, int linieb) {
  if (m == 4) {
    cout << (liniea - 1) * m + 2 << " " << (liniea - 1) * m + 4 << " "
         << (liniea - 1) * m + 1 << " " << (liniea - 1) * m + 3 << '\n';
    cout << (linieb - 1) * m + 3 << " " << (linieb - 1) * m + 1 << " "
         << (linieb - 1) * m + 4 << " " << (linieb - 1) * m + 2 << '\n';
  } else {
    int nr = 1;
    int nr2 = 2;
    for (int i = 1; i <= m; ++i) {
      if (nr <= m)
        cout << (liniea - 1) * m + nr << " ", nr += 2;
      else
        cout << (liniea - 1) * m + nr2 << " ", nr2 += 2;
    }
    cout << '\n';
    if (m % 2 == 0) {
      nr = 1;
      nr2 = 2;
      for (int i = 1; i <= m; ++i) {
        if (nr2 <= m)
          cout << (linieb - 1) * m + nr2 << " ", nr2 += 2;
        else
          cout << (linieb - 1) * m + nr << " ", nr += 2;
      }
      cout << '\n';
    } else {
      cout << (linieb - 1) * m + 3 << " ";
      nr2 = 5;
      while (nr2 <= m) cout << (linieb - 1) * m + nr2 << " ", nr2 += 2;
      cout << (linieb - 1) * m + 1 << " ";
      cout << (linieb - 1) * m + 4 << " ";
      nr = 6;
      while (nr <= m) cout << (linieb - 1) * m + nr << " ", nr += 2;
      cout << (linieb - 1) * m + 2 << '\n';
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  if (n == 1 && m == 1) {
    cout << "YES\n";
    cout << 1;
    return 0;
  }
  if (n <= 2 && m <= 3) {
    cout << "NO";
    return 0;
  }
  if (n == 3 && m <= 2) {
    cout << "NO";
    return 0;
  }
  cout << "YES\n";
  if (n <= m) {
    if (n == 3 && m == 3) {
      cout << "1 3 8\n5 9 4\n7 2 6\n";
      return 0;
    }
    if (n == 2 && m == 4) {
      cout << "2 4 1 3\n7 5 8 6\n";
      return 0;
    }
    if (n == 2 && m == 5) {
      cout << "1 3 5 2 4\n8 10 7 9 6\n";
      return 0;
    }
    if (n == 2 && m == 6) {
      cout << "1 3 5 2 4 6\n8 10 12 7 9 11\n";
      return 0;
    }
    if (n == 2 && m == 7) {
      cout << "1 3 5 7 2 4 6\n10 12 14 8 11 13 9\n";
      return 0;
    }
    for (int i = 1; i + 1 <= n; i += 2) solvetwo(i + 1, i);
    if (n % 2 == 1) solveone(n);
  } else {
    if (m >= 4) {
      for (int i = 1; i + 1 <= n; i += 2) solvetwo(i + 1, i);
      if (n % 2 == 1) solveone(n);
    } else {
      if (n == 4 && m == 2) {
        cout << "1 5\n4 8\n7 2\n3 6\n";
        return 0;
      }
      if (m == 2) {
        int p1 = 1;
        int p2 = 2;
        for (int i = 1; i <= n; ++i) {
          cout << p1 * 2 - 1 << " " << p2 * 2 << '\n';
          p1 += 2;
          p2 += 2;
          if (p1 > n) p1 = 2;
          if (p2 > n) p2 = 1;
        }
        return 0;
      }
      if (n == 4 && m == 3) {
        cout << "1 3 5\n6 8 10\n2 4 12\n9 11 7\n";
        return 0;
      }
      if (m == 3) {
        int p1 = 1;
        int p2 = 2;
        int p3 = 1;
        for (int i = 1; i <= n; ++i) {
          cout << (p1 - 1) * 3 + 1 << " " << (p2 - 1) * 3 + 2 << " " << p3 * 3
               << '\n';
          p1 += 2;
          p2 += 2;
          p3 += 2;
          if (p1 > n) p1 = 2;
          if (p2 > n) p2 = 1;
          if (p3 > n) p3 = 2;
        }
        return 0;
      }
      if (m == 1) {
        int p1 = 2;
        for (int i = 1; i <= n; ++i) {
          cout << p1 << '\n';
          p1 += 2;
          if (p1 > n) p1 = 1;
        }
        return 0;
      }
    }
  }
  return 0;
}
