#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  if (n == 1) {
    if (m == 1) {
      cout << "YES" << endl;
      cout << 1 << endl;
      return;
    }
    if (m == 2 || m == 3) {
      cout << "NO" << endl;
      return;
    } else {
      cout << "YES" << endl;
      if (m % 2) {
        for (int i = m; i >= 1; i = i - 2) {
          cout << i << " ";
        }
        for (int i = m - 1; i >= 2; i = i - 2) {
          cout << i << " ";
        }
      } else {
        for (int i = m - 1; i >= 1; i = i - 2) {
          cout << i << " ";
        }
        for (int i = m; i >= 2; i = i - 2) {
          cout << i << " ";
        }
      }
      return;
    }
  }
  if (m == 1) {
    if (n == 1) {
      cout << "YES" << endl;
      cout << 1 << endl;
      return;
    }
    if (n == 2 || n == 3) {
      cout << "NO" << endl;
      return;
    } else {
      cout << "YES" << endl;
      if (n % 2) {
        for (int i = n; i >= 1; i = i - 2) {
          cout << i << endl;
        }
        for (int i = n - 1; i >= 2; i = i - 2) {
          cout << i << endl;
        }
      } else {
        for (int i = n - 1; i >= 1; i = i - 2) {
          cout << i << endl;
        }
        for (int i = n; i >= 2; i = i - 2) {
          cout << i << endl;
        }
      }
      return;
    }
  }
  if (n == 2) {
    if (m < 4) {
      cout << "NO" << endl;
      return;
    }
    if (m == 4) {
      cout << "YES" << endl;
      cout << "5 4 7 2" << endl << "3 6 1 8" << endl;
      return;
    }
    cout << "YES" << endl;
    if (m % 2) {
      for (int i = 2; i <= m; i = i + 2) {
        cout << i << " ";
      }
      for (int i = 1; i <= m; i = i + 2) {
        cout << i << " ";
      }
      cout << endl;
      for (int i = m + 1; i <= 2 * m; i = i + 2) {
        cout << i << " ";
      }
      for (int i = m + 2; i <= 2 * m; i = i + 2) {
        cout << i << " ";
      }
      cout << endl;
      return;
    } else {
      for (int i = 2; i <= 2 * m; i = i + 2) {
        cout << i << " ";
      }
      cout << endl;
      for (int i = 2 * m - 1; i >= 1; i = i - 2) {
        cout << i << " ";
      }
      cout << endl;
      return;
    }
  }
  if (m == 2) {
    if (n == 3) {
      cout << "NO" << endl;
      return;
    }
    if (n == 4) {
      cout << "YES" << endl;
      cout << "3 6" << endl << "7 2" << endl << "1 8" << endl << "5 4" << endl;
      return;
    }
    if (n % 2 == 0) {
      vector<int> a;
      vector<int> b;
      for (int i = 1; i <= 2 * n; i = i + 4) {
        a.push_back(i);
      }
      for (int i = 3; i <= 2 * n; i = i + 4) {
        a.push_back(i);
      }
      for (int i = 2 * n; i > 1; i = i - 4) {
        b.push_back(i);
      }
      for (int i = 2 * n - 2; i > 1; i = i - 4) {
        b.push_back(i);
      }
      cout << "YES" << endl;
      for (int i = 0; i < n; i++) {
        cout << a[i] << " " << b[i] << endl;
      }
      cout << endl;
      return;
    } else {
      cout << "YES" << endl;
      for (int i = 1; i <= 2 * n - 2; i = i + 4) {
        cout << i << " " << i + 3 << endl;
      }
      cout << 2 * n - 1 << " " << 2 << endl;
      for (int i = 3; i < 2 * n; i = i + 4) {
        cout << i << " " << i + 3 << endl;
      }
      return;
    }
  }
  if (n == 3) {
    if (m == 3) {
      cout << "YES" << endl;
      cout << "1 3 4" << endl << "5 7 6" << endl << "9 2 8" << endl;
      return;
    }
    if (m == 4) {
      cout << "YES" << endl;
      cout << "2 4 1 3" << endl << "7 5 8 6" << endl << "10 12 9 11" << endl;
      return;
    }
    if (m % 2 == 0) {
      cout << "YES" << endl;
      for (int i = 2; i <= m; i = i + 2) {
        cout << i << " ";
      }
      for (int i = 1; i <= m; i = i + 2) {
        cout << i << " ";
      }
      cout << endl;
      for (int i = m - 1; i >= 1; i = i - 2) {
        cout << i + m << " ";
      }
      for (int i = m; i >= 1; i = i - 2) {
        cout << i + m << " ";
      }
      cout << endl;
      for (int i = 2; i <= m; i = i + 2) {
        cout << i + 2 * m << " ";
      }
      for (int i = 1; i <= m; i = i + 2) {
        cout << i + 2 * m << " ";
      }
      cout << endl;
      return;
    } else {
      cout << "YES" << endl;
      for (int i = 1; i <= m; i = i + 2) {
        cout << i << " ";
      }
      for (int i = 2; i <= m; i = i + 2) {
        cout << i << " ";
      }
      cout << endl;
      for (int i = 1; i < m; i = i + 2) {
        cout << i + m + 1 << " ";
      }
      cout << m + 1 << " ";
      for (int i = 2; i <= m; i = i + 2) {
        cout << i + m + 1 << " ";
      }
      cout << endl;
      for (int i = 1; i <= m; i = i + 2) {
        cout << i + 2 * m << " ";
      }
      for (int i = 2; i <= m; i = i + 2) {
        cout << i + 2 * m << " ";
      }
      return;
    }
  }
  if (m == 3) {
    if (n == 4) {
      cout << "YES" << endl;
      cout << "4 8 6"
           << "10 2 12" << endl
           << "1 11 3"
           << "7 5 9" << endl;
      return;
    }
    if (n % 2) {
      cout << "YES" << endl;
      for (int i = 1; i <= 3 * n - 3; i = i + 6) {
        cout << i << " " << i + 4 << " " << i + 2 << endl;
      }
      cout << 3 * n - 2 << " " << 2 << " " << 3 * n << endl;
      for (int i = 4; i < 3 * n; i = i + 6) {
        cout << i << " " << i + 4 << " " << i + 2 << endl;
      }
      return;
    } else {
      cout << "YES" << endl;
      for (int i = 4; i < 3 * n; i = i + 6) {
        cout << i << " " << 3 * n - i << " " << i + 2 << endl;
      }
      for (int i = 1; i < 3 * n; i = i + 6) {
        cout << i << " " << 3 * n - i << " " << i + 2 << endl;
      }
      return;
    }
  }
  cout << "YES" << endl;
  vector<int> g;
  vector<int> v;
  if (m % 2) {
    for (int i = m; i >= 1; i = i - 2) {
      g.push_back(i);
    }
    for (int i = m - 1; i >= 2; i = i - 2) {
      g.push_back(i);
    }
  } else {
    for (int i = m - 1; i >= 1; i = i - 2) {
      g.push_back(i);
    }
    for (int i = m; i >= 2; i = i - 2) {
      g.push_back(i);
    }
  }
  if (n % 2) {
    for (int i = n; i >= 1; i = i - 2) {
      v.push_back(i);
    }
    for (int i = n - 1; i >= 2; i = i - 2) {
      v.push_back(i);
    }
  } else {
    for (int i = n - 1; i >= 1; i = i - 2) {
      v.push_back(i);
    }
    for (int i = n; i >= 2; i = i - 2) {
      v.push_back(i);
    }
  }
  for (int j = 0; j < n; j++) {
    for (int i = 0; i < m; i++) {
      cout << g[i] + m * (v[j] - 1) << " ";
    }
    cout << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  int cnt = 1;
  while (cnt--) {
    solve();
  }
}
