#include<cstdio>
#include<algorithm>
#define rp(i,x,y) for (int i=x;i<=y;i++)
const int N=1e5+10,SQN=320;
using namespace std;
int f[N][SQN],lin[N],n,m;
void change(int f[],int len,int flg)
{
    if (len==4)
        swap(f[0],f[2]),swap(f[1],f[2]),swap(f[3],f[2]);
    else if (len>4)
    {
        rp(i,0,(len-1)/2)
            lin[i]=f[i*2],lin[i+(len-1)/2+1]=f[i*2+1];
        rp(i,0,len-1)
            f[i]=lin[i];
    }
    if (flg)
        rp(i,0,(len-1)/2)
            swap(f[i],f[len-i-1]);
}

int main(void)
{
    scanf("%d%d",&n,&m);
    if (n==3&&m==3)
        printf("YES\n6 2 7\n1 9 5\n8 4 3\n");
    else if (n==1&&m==1)
        printf("YES\n1\n");
    else if (max(n,m)>=4)
    {
        printf("YES\n");
        int cnt=0;
        rp(i,0,min(n,m)-1)
            rp(j,0,max(n,m)-1)
                f[i][j]=++cnt;
        rp(i,0,min(n,m)-1)
            change(f[i],max(n,m),i);
        if (m==max(n,m))
            rp(i,0,(m==max(n,m)?n-1:m-1))
            {
                rp(j,0,(m==max(n,m)?m-1:n-1))
                    printf("%d ",f[i][j]);
                printf("\n");
            }
    }
    else printf("NO\n");
    return 0;
}


#include<cstdio>
#include<algorithm>
#define rp(i,x,y) for (int i=x;i<=y;i++)
const int N=1e5+10,SQN=320;
using namespace std;
int f[N][SQN],lin[N],n,m;
void change(int f[],int len,int flg)
{
    if (len==4)
        swap(f[0],f[2]),swap(f[1],f[2]),swap(f[3],f[2]);
    else if (len>4)
    {
        rp(i,0,(len-1)/2)
            lin[i]=f[i*2],lin[i+(len-1)/2+1]=f[i*2+1];
        rp(i,0,len-1)
            f[i]=lin[i];
    }
    if (flg)
        rp(i,0,(len-1)/2)
            swap(f[i],f[len-i-1]);
}

int main(void)
{
    scanf("%d%d",&n,&m);
    if (n==3&&m==3)
        printf("YES\n6 2 7\n1 9 5\n8 4 3\n");
    else if (n==1&&m==1)
        printf("YES\n1\n");
    else if (max(n,m)>=4)
    {
        printf("YES\n");
        int cnt=0;
        rp(i,0,n-1)
            rp(j,0,m-1)
            f[i][j]=++cnt;
        if (m!=max(n,m))
            rp(i,0,n-1)
                rp(j,i+1,n-1)
                swap(f[i][j],f[j][i]);
        rp(i,0,min(n,m)-1)
            change(f[i],max(n,m),i);
        rp(i,0,n-1)
        {
            rp(j,0,m-1)
                printf("%d ",m==max(n,m)?f[i][j]:f[j][i]);
            printf("\n");
        }
    }
    else printf("NO\n");
    return 0;
}


#include<cstdio>
#include<algorithm>
#define rp(i,x,y) for (int i=x;i<=y;i++)
const int N=1e5+10,SQN=320;
using namespace std;
int f[N][SQN],lin[N],n,m;
void change(int f[],int len,int flg)
{
    if (len==4)
        swap(f[0],f[2]),swap(f[1],f[2]),swap(f[3],f[2]);
    else if (len>4)
    {
        rp(i,0,(len-1)/2)
            lin[i]=f[i*2],lin[i+(len-1)/2+1]=f[i*2+1];
        rp(i,0,len-1)
            f[i]=lin[i];
    }
    if (flg)
        rp(i,0,(len-1)/2)
            swap(f[i],f[len-i-1]);
}

int main(void)
{
    scanf("%d%d",&n,&m);
    if (n==3&&m==3)
        printf("YES\n6 2 7\n1 9 5\n8 4 3\n");
    else if (n==1&&m==1)
        printf("YES\n1\n");
    else if (max(n,m)>=4)
    {
        printf("YES\n");
        int cnt=0;
        rp(i,0,min(n,m)-1)
            rp(j,0,max(n,m)-1)
            f[i][j]=++cnt;
        rp(i,0,min(n,m)-1)
            change(f[i],max(n,m),i);
        rp(i,0,n-1)
        {
            rp(j,0,m-1)
                printf("%d ",m==max(n,m)?f[i][j]:f[j][i]);
            printf("\n");
        }
    }
    else printf("NO\n");
    return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

int tr[100010];
int tmp[100010];

int main() {
    int n, m;
    int swp = 0;
    scanf("%d %d",&n,&m);
    if(n <= 2 && m <= 2) {
        if(n == 1 && m == 1) printf("1\n");
        else printf("NO\n");
        return 0;
    }
    if(n <= 2 && m == 3) {
        printf("NO\n");
        return 0;
    }
    if(n == 3 && m <= 2) {
        printf("NO\n");
        return 0;
    }
    printf("YES\n");
    if(n == 3 && m == 3) {
        printf("5 1 8\n");
        printf("3 9 4\n");
        printf("7 2 6\n");
        return 0;
    }
    for(int i = 0; i < n*m; i++) tr[i] = i + 1;
    if(n > m) {
        swp = 1;
        for(int i = 0; i < n*m; i++) tr[i] = ((i % n) * m) + (i / n) + 1;
        swap(n, m);
    }
    vector<vector<int> > ans(n, vector<int>(m, 0));
    for(int i = 0; i < n; i+=2) {
        if(i + 1 == n) {
            if(m & 1) {
                for(int k = n - 1; k >= 1; k--) for(int l = 0; l < m; l++) ans[k][l] = ans[k-1][l];
                for(int j = 0; j < m; j += 2) ans[0][j] = i * m + (j / 2);
                for(int j = 1; j < m; j += 2) ans[0][j] = i * m + (j / 2) + ((m + 1) / 2);
            }
            else {
                for(int j = 0; j < m; j += 2) ans[i][j] = i * m + (j / 2);
                for(int j = 1; j < m; j += 2) ans[i][j] = i * m + (j / 2) + ((m + 1) / 2);
            }
            break;
        }
        for(int j = 0; j < m; j += 2) ans[i][j] = j + i * m;
        for(int j = 1; j < m; j += 2) ans[i+1][j] = j + i * m;

        for(int j = 0; j < m / 2; j++) tmp[j] = (i + 1) * m + m - j - 1;
        for(int j = m / 2; j < m; j++) tmp[j] = (i + 1) * m + j - m / 2;

        for(int j = 1; j < m; j += 2) ans[i][j] =  tmp[j];
        for(int j = 0; j < m; j += 2) ans[i + 1][j] = tmp[j];
    }
    if(swp) {
        for(int i = 0; i < m; i++) {
            for(int j = 0; j < n; j++) printf("%d ",tr[ans[j][i]]);
            printf("\n");
        }
        return 0;
    }
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) printf("%d ",tr[ans[i][j]]);
        printf("\n");
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define pi pair<int,int>
#define pb push_back
#define fi first
#define se second
#define inf 1e9
#ifndef LOCAL
#define endl '\n'
#endif

const int N = 505;

vector<vector<int> > a;

signed main() {
	#ifdef LOCAL
		freopen("input.txt","r",stdin);
	#endif
	IOS;
	int n, m;
	cin >> n >> m;
	bool flag = 0;
	if(n > m)
		flag = 1, swap(n, m);
	a.resize(n, vector<int>(m));
	int c = 1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++)
			a[i][j] = c++;
	}
	if(n == 1){
		if(m == 1){
			cout << "YES\n1";
			return 0;
		}
		else if(m <= 3)
			return cout << "NO", 0;
		else if(m == 4)
			a[0][0] = 2, a[0][1] = 4, a[0][2] = 1, a[0][3] = 3;
		else{
			int j = 0;
			for(int i = 1; i <= m; i += 2)
				a[0][j++] = i;
			for(int i = 2; i <= m; i += 2)
				a[0][j++] = i;
		}
	}
	else if(n == 2 && m <= 3)
		return cout << "NO", 0;
	else{
		for(int i = 1; i < n; i += 2){
			int temp = a[i][0], j;
			for(j = 0; j < m-1; j++)
				a[i][j] = a[i][j+1];
			a[i][j] = temp;
			temp = a[i][0];
			for(j = 0; j < m-1; j++)
				a[i][j] = a[i][j+1];
			a[i][j] = temp;
		}
		for(int i = 1; i < m; i += 2){
			int temp = a[0][i], j;
			for(j = 0; j < n-1; j++)
				a[j][i] = a[j+1][i];
			a[j][i] = temp;
		}
	}
	cout << "YES" << endl;
	if(flag == 0){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++)
				cout << a[i][j] << " ";
			cout << endl;
		}
	}
	else{
		for(int i = 0; i < m; i++){
			for(int j = 0; j < n; j++)
				cout << a[j][i] << " ";
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define pi pair<int,int>
#define pb push_back
#define fi first
#define se second
#define inf 1e9
#ifndef LOCAL
#define endl '\n'
#endif

const int N = 505;

vector<vector<int> > a;

signed main() {
	#ifdef LOCAL
		freopen("input.txt","r",stdin);
	#endif
	IOS;
	int n, m;
	cin >> n >> m;
	bool flag = 0;
	if(n > m)
		flag = 1, swap(n, m);
	a.resize(n, vector<int>(m));
	int c = 1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++)
			a[i][j] = c++;
	}
	if(n == 1){
		if(m <= 3)
			return cout << "NO", 0;
		else if(m == 4)
			a[0][0] = 2, a[0][1] = 4, a[0][2] = 1, a[0][3] = 3;
		else{
			int j = 0;
			for(int i = 1; i <= m; i += 2)
				a[0][j++] = i;
			for(int i = 2; i <= m; i += 2)
				a[0][j++] = i;
		}
	}
	else if(n == 2 && m == 3)
		return cout << "NO", 0;
	else{
		if(m <= 3)
			return cout << "NO", 0;
		else{
			for(int i = 1; i < n; i += 2){
				int temp = a[i][0], j;
				for(j = 0; j < m-2; j += 2)
					a[i][j] = a[i][j+2];
				a[i][j] = temp;
				temp = a[i][1], j = 1;
				for(j = 1; j < m-2; j += 2)
					a[i][j] = a[i][j+2];
				a[i][j] = temp;
			}
			for(int i = 1; i < m; i += 2){
				int temp = a[0][i], j;
				for(j = 0; j < n-1; j++)
					a[j][i] = a[j+1][i];
				a[j][i] = temp;
			}
		}
	}
	cout << "YES" << endl;
	if(flag == 0){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++)
				cout << a[i][j] << " ";
			cout << endl;
		}
	}
	else{
		for(int i = 0; i < m; i++){
			for(int j = 0; j < n; j++)
				cout << a[j][i] << " ";
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define pi pair<int,int>
#define pb push_back
#define fi first
#define se second
#define inf 1e9
#ifndef LOCAL
#define endl '\n'
#endif

const int N = 505;

vector<vector<int> > a;

signed main() {
	#ifdef LOCAL
		freopen("input.txt","r",stdin);
	#endif
	IOS;
	int n, m;
	cin >> n >> m;
	bool flag = 0;
	if(n > m)
		flag = 1, swap(n, m);
	a.resize(n, vector<int>(m));
	int c = 1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++)
			a[i][j] = c++;
	}
	if(n == 1){
		if(m == 1){
			cout << "YES\n1";
			return 0;
		}
		else if(m <= 3)
			return cout << "NO", 0;
		else if(m == 4)
			a[0][0] = 2, a[0][1] = 4, a[0][2] = 1, a[0][3] = 3;
		else{
			int j = 0;
			for(int i = 1; i <= m; i += 2)
				a[0][j++] = i;
			for(int i = 2; i <= m; i += 2)
				a[0][j++] = i;
		}
	}
	else if(n == 2 && m == 3)
		return cout << "NO", 0;
	else{
		for(int i = 1; i < n; i += 2){
			int temp = a[i][0], j;
			for(j = 0; j < m-2; j += 2)
				a[i][j] = a[i][j+2];
			a[i][j] = temp;
			temp = a[i][1], j = 1;
			for(j = 1; j < m-2; j += 2)
				a[i][j] = a[i][j+2];
			a[i][j] = temp;
		}
		for(int i = 1; i < m; i += 2){
			int temp = a[0][i], j;
			for(j = 0; j < n-1; j++)
				a[j][i] = a[j+1][i];
			a[j][i] = temp;
		}
	}
	cout << "YES" << endl;
	if(flag == 0){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++)
				cout << a[i][j] << " ";
			cout << endl;
		}
	}
	else{
		for(int i = 0; i < m; i++){
			for(int j = 0; j < n; j++)
				cout << a[j][i] << " ";
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define pi pair<int,int>
#define pb push_back
#define fi first
#define se second
#define inf 1e9
#ifndef LOCAL
#define endl '\n'
#endif

const int N = 505;

vector<vector<int> > a;

signed main() {
	#ifdef LOCAL
		freopen("input.txt","r",stdin);
	#endif
	IOS;
	int n, m;
	cin >> n >> m;
	bool flag = 0;
	if(n > m)
		flag = 1, swap(n, m);
	a.resize(n, vector<int>(m));
	int c = 1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++)
			a[i][j] = c++;
	}
	if(n == 1){
		if(m == 1){
			cout << "YES\n1";
			return 0;
		}
		else if(m <= 3)
			return cout << "NO", 0;
		else if(m == 4)
			a[0][0] = 2, a[0][1] = 4, a[0][2] = 1, a[0][3] = 3;
		else{
			int j = 0;
			for(int i = 1; i <= m; i += 2)
				a[0][j++] = i;
			for(int i = 2; i <= m; i += 2)
				a[0][j++] = i;
		}
	}
	else if(n == 2 && m <= 3)
		return cout << "NO", 0;
	else{
		if(m == 3){
			cout << "YES\n6 1 8\n7 5 3\n2 9 4";
			return 0;
		}
		for(int i = 1; i < n; i += 2){
			int temp = a[i][m-1], j;
			for(j = m-1; j >= 1; j--)
				a[i][j] = a[i][j-1];
			a[i][j] = temp;
			temp = a[i][m-1];
			for(j = m-1; j >= 1; j--)
				a[i][j] = a[i][j-1];
			a[i][j] = temp;
		}
		for(int i = 1; i < m; i += 2){
			int temp = a[0][i], j;
			for(j = 0; j < n-1; j++)
				a[j][i] = a[j+1][i];
			a[j][i] = temp;
		}
	}
	cout << "YES" << endl;
	if(flag == 0){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++)
				cout << a[i][j] << " ";
			cout << endl;
		}
	}
	else{
		for(int i = 0; i < m; i++){
			for(int j = 0; j < n; j++)
				cout << a[j][i] << " ";
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define pi pair<int,int>
#define pb push_back
#define fi first
#define se second
#define inf 1e9
#ifndef LOCAL
#define endl '\n'
#endif

const int N = 505;

vector<vector<int> > a;

signed main() {
	#ifdef LOCAL
		freopen("input.txt","r",stdin);
	#endif
	IOS;
	int n, m;
	cin >> n >> m;
	a.resize(n, vector<int>(m));
	if(n <= m){
		int c = 1;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++)
				a[i][j] = c++;
		}
		if(n == 1){
			if(m == 1){
				cout << "YES\n1";
				return 0;
			}
			else if(m <= 3)
				return cout << "NO", 0;
			else if(m == 4)
				a[0][0] = 2, a[0][1] = 4, a[0][2] = 1, a[0][3] = 3;
			else{
				int j = 0;
				for(int i = 1; i <= m; i += 2)
					a[0][j++] = i;
				for(int i = 2; i <= m; i += 2)
					a[0][j++] = i;
			}
		}
		else if(n == 2 && m <= 3)
			return cout << "NO", 0;
		else{
			if(m == 3){
				cout << "YES\n6 1 8\n7 5 3\n2 9 4";
				return 0;
			}
			for(int i = 1; i < n; i += 2){
				int temp = a[i][m-1], j;
				for(j = m-1; j >= 1; j--)
					a[i][j] = a[i][j-1];
				a[i][j] = temp;
				temp = a[i][m-1];
				for(j = m-1; j >= 1; j--)
					a[i][j] = a[i][j-1];
				a[i][j] = temp;
			}
			for(int i = 1; i < m; i += 2){
				int temp = a[0][i], j;
				for(j = 0; j < n-1; j++)
					a[j][i] = a[j+1][i];
				a[j][i] = temp;
			}
		}
		cout << "YES" << endl;
			for(int i = 0; i < n; i++){
				for(int j = 0; j < m; j++)
					cout << a[i][j] << " ";
				cout << endl;
			}
	}
	else{
		int c = 1;
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++)
				a[i][j] = c++;
		}
		if(m == 1){
			if(n == 1){
				cout << "YES\n1";
				return 0;
			}
			else if(n <= 3)
				return cout << "NO", 0;
			else if(n == 4)
				a[0][0] = 2, a[1][0] = 4, a[2][0] = 1, a[3][0] = 3;
			else{
				int j = 0;
				for(int i = 1; i <= n; i += 2)
					a[j++][0] = i;
				for(int i = 2; i <= n; i += 2)
					a[j++][0] = i;
			}
		}
		else if(m == 2 && n <= 3)
			return cout << "NO", 0;
		else{
			if(n == 3){
				cout << "YES\n6 1 8\n7 5 3\n2 9 4";
				return 0;
			}
			for(int i = 1; i < m; i += 2){
				int temp = a[n-1][i], j;
				for(j = n-1; j >= 1; j--)
					a[j][i] = a[j-1][i];
				a[j][i] = temp;
				temp = a[n-1][i];
				for(j = n-1; j >= 1; j--)
					a[j][i] = a[j-1][i];
				a[j][i] = temp;
			}
			for(int i = 1; i < n; i += 2){
				int temp = a[i][0], j;
				for(j = 0; j < m-1; j++)
					a[i][j] = a[i][j+1];
				a[i][j] = temp;
			}
		}
		cout << "YES" << endl;
			for(int i = 0; i < n; i++){
				for(int j = 0; j < m; j++)
					cout << a[i][j] << " ";
				cout << endl;
			}
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define pi pair<int,int>
#define pb push_back
#define fi first
#define se second
#define inf 1e9
#ifndef LOCAL
#define endl '\n'
#endif

const int N = 505;

vector<vector<int> > a;

signed main() {
	#ifdef LOCAL
		freopen("input.txt","r",stdin);
	#endif
	IOS;
	int n, m;
	cin >> n >> m;
	bool flag = 0;
	if(n > m)
		flag = 1, swap(n, m);
	a.resize(n, vector<int>(m));
	int c = 1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++)
			a[i][j] = c++;
	}
	if(n == 1){
		if(m == 1){
			cout << "YES\n1";
			return 0;
		}
		else if(m <= 3)
			return cout << "NO", 0;
		else if(m == 4)
			a[0][0] = 2, a[0][1] = 4, a[0][2] = 1, a[0][3] = 3;
		else{
			int j = 0;
			for(int i = 1; i <= m; i += 2)
				a[0][j++] = i;
			for(int i = 2; i <= m; i += 2)
				a[0][j++] = i;
		}
	}
	else if(n == 2 && m == 3)
		return cout << "NO", 0;
	else{
		if(m <= 3)
			return cout << "NO", 0;
		else{
			for(int i = 1; i < n; i += 2){
				int temp = a[i][0], j;
				for(j = 0; j < m-2; j += 2)
					a[i][j] = a[i][j+2];
				a[i][j] = temp;
				temp = a[i][1], j = 1;
				for(j = 1; j < m-2; j += 2)
					a[i][j] = a[i][j+2];
				a[i][j] = temp;
			}
			for(int i = 1; i < m; i += 2){
				int temp = a[0][i], j;
				for(j = 0; j < n-1; j++)
					a[j][i] = a[j+1][i];
				a[j][i] = temp;
			}
		}
	}
	cout << "YES" << endl;
	if(flag == 0){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++)
				cout << a[i][j] << " ";
			cout << endl;
		}
	}
	else{
		for(int i = 0; i < m; i++){
			for(int j = 0; j < n; j++)
				cout << a[j][i] << " ";
			cout << endl;
		}
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long int
#define pi pair<int,int>
#define pb push_back
#define fi first
#define se second
#define inf 1e9
#ifndef LOCAL
#define endl '\n'
#endif

const int N = 505;

vector<vector<int> > a;

signed main() {
	#ifdef LOCAL
		freopen("input.txt","r",stdin);
	#endif
	IOS;
	int n, m;
	cin >> n >> m;
	bool flag = 0;
	if(n > m)
		flag = 1, swap(n, m);
	a.resize(n, vector<int>(m));
	int c = 1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++)
			a[i][j] = c++;
	}
	if(n == 1){
		if(m == 1){
			cout << "YES\n1";
			return 0;
		}
		else if(m <= 3)
			return cout << "NO", 0;
		else if(m == 4)
			a[0][0] = 2, a[0][1] = 4, a[0][2] = 1, a[0][3] = 3;
		else{
			int j = 0;
			for(int i = 1; i <= m; i += 2)
				a[0][j++] = i;
			for(int i = 2; i <= m; i += 2)
				a[0][j++] = i;
		}
	}
	else if(n == 2 && m <= 3)
		return cout << "NO", 0;
	else{
		for(int i = 1; i < n; i += 2){
			int temp = a[i][0], j;
			for(j = 0; j < m-2; j += 2)
				a[i][j] = a[i][j+2];
			a[i][j] = temp;
			temp = a[i][1], j = 1;
			for(j = 1; j < m-2; j += 2)
				a[i][j] = a[i][j+2];
			a[i][j] = temp;
		}
		for(int i = 1; i < m; i += 2){
			int temp = a[0][i], j;
			for(j = 0; j < n-1; j++)
				a[j][i] = a[j+1][i];
			a[j][i] = temp;
		}
	}
	cout << "YES" << endl;
	if(flag == 0){
		for(int i = 0; i < n; i++){
			for(int j = 0; j < m; j++)
				cout << a[i][j] << " ";
			cout << endl;
		}
	}
	else{
		for(int i = 0; i < m; i++){
			for(int j = 0; j < n; j++)
				cout << a[j][i] << " ";
			cout << endl;
		}
	}
	return 0;
}


//  Created by Vignesh Manoharan

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <numeric>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const int INF = 1000000000;
const ll LINF = 1e17;
const double PI =3.141592653589793238;
const ll lmod = 1000000007l;
const int mod=1000000007;
const double eps = 0.000001;
#pragma unused(INF, LINF, PI, lmod, mod, eps)

#define F(i,a,n) for(int i=(a);i<(n);i++)

template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){
    for(int i=0;i<(t).size();i++)s<<t[i]<<((i<(t).size()-1)?" ":"");return s; }
template<typename T> ostream& operator<<(ostream &s,set<T> t){for(T x:t) s<<x<<" ";return s; }
template<typename T> istream& operator>>(istream &s,vector<T> &t){
    for(int _i=0;_i<t.size();_i++) s>>t[_i];return s; }

#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()

int check(int n, int m, vi x){
    // neighbours of x= x+1,x-1,x+m,x-m
    int ok=1;
    F(i,0,n) F(j,0,m){
        if(!ok) break;
        set<int> on,cn;
        int curr=x[m*i+j];
        if(i>0) cn.insert(x[m*(i-1)+j]);
        if(i<n-1) cn.insert(x[m*(i+1)+j]);
        if(j>0) cn.insert(x[m*i+j-1]);
        if(j<m-1) cn.insert(x[m*i+j+1]);
        int cr=curr/m,cc=curr%m;
        if(cr>0) on.insert(m*(cr-1)+cc);
        if(cr<n-1) on.insert(m*(cr+1)+cc);
        if(cc>0) on.insert(m*(cr)+cc-1);
        if(cc<m-1) on.insert(m*(cr)+cc+1);
        //cout<<on<<"\n"<<cn<<"\n";
        for(int cne: cn){
            if(on.count(cne)){
                ok=0;
                break;
            }
        }
    }
    return ok;
}
void seq(int n, int type, vi &x){
    if(n==4){
        if(type==1) x={1,3,0,2};
        else x={2,0,3,1};
    } else {
        if(type==1){
            F(i,0,(n+1)/2) x[i]=2*i;
            F(i,0,(n)/2) x[i+(n+1)/2]=2*i+1;
        } else {
            F(i,0,(n)/2) x[i]=2*i+1;
            F(i,0,(n+1)/2) x[i+(n)/2]=2*i;
        }
    }
}
int main(int argc, const char * argv[]) {
    #ifdef LOCAL_TEST
    freopen("input", "r", stdin);
    freopen("output", "w", stdout);
    #endif
    int n,m;
    cin>>n>>m;
    if(n<4 && m<4){
        vi x(n*m);
        F(i,0,n*m) x[i]=i;
        int ok=0;
        do{
            if(check(n,m,x)) {
                ok=1;
                break;
            }
        }while(next_permutation(all(x)));
        if(ok){
            cout<<"YES\n";
            F(j,0,m) {F(i,0,n) cout<<x[i*m+j]+1<<" "; cout<<"\n";}
        }else
            cout<<"NO\n";
    } else {
        if(m>=4){
            vi y1(m),y2(m);
            seq(m,1,y1);
            seq(m,2,y2);
            vvi y(n, vi(m));
            F(i,0,n){
                if(i%2==0) F(j,0,m) y[i][j]=y1[j]+m*i;
                else F(j,0,m) y[i][j]=y2[j]+m*i;
            }
            cout<<"YES\n";
            F(i,0,n) {F(j,0,m) cout<<y[i][j]+1<<" "; cout<<"\n";}
        } else {

            vi y1(n),y2(n);
            seq(n,1,y1);
            seq(n,2,y2);
            vvi y(n, vi(m));
            F(i,0,m){
                if(i%2==0) F(j,0,n) y[j][i]=m*y1[j]+i;
                else F(j,0,n) y[j][i]=m*y2[j]+i;
            }
            cout<<"YES\n";
            F(i,0,n) {F(j,0,m) cout<<y[i][j]+1<<" "; cout<<"\n";}
        }
    }
}


//  Created by Vignesh Manoharan

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <numeric>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const int INF = 1000000000;
const ll LINF = 1e17;
const double PI =3.141592653589793238;
const ll lmod = 1000000007l;
const int mod=1000000007;
const double eps = 0.000001;
#pragma unused(INF, LINF, PI, lmod, mod, eps)

#define F(i,a,n) for(int i=(a);i<(n);i++)

template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){
    for(int i=0;i<(t).size();i++)s<<t[i]<<((i<(t).size()-1)?" ":"");return s; }
template<typename T> ostream& operator<<(ostream &s,set<T> t){for(T x:t) s<<x<<" ";return s; }
template<typename T> istream& operator>>(istream &s,vector<T> &t){
    for(int _i=0;_i<t.size();_i++) s>>t[_i];return s; }

#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()

int check(int n, int m, vi x){
    // neighbours of x= x+1,x-1,x+m,x-m
    int ok=1;
    F(i,0,n) F(j,0,m){
        if(!ok) break;
        set<int> on,cn;
        int curr=x[m*i+j];
        if(i>0) cn.insert(x[m*(i-1)+j]);
        if(i<n-1) cn.insert(x[m*(i+1)+j]);
        if(j>0) cn.insert(x[m*i+j-1]);
        if(j<m-1) cn.insert(x[m*i+j+1]);
        int cr=curr/m,cc=curr%m;
        if(cr>0) on.insert(m*(cr-1)+cc);
        if(cr<n-1) on.insert(m*(cr+1)+cc);
        if(cc>0) on.insert(m*(cr)+cc-1);
        if(cc<m-1) on.insert(m*(cr)+cc+1);
        //cout<<on<<"\n"<<cn<<"\n";
        for(int cne: cn){
            if(on.count(cne)){
                ok=0;
                break;
            }
        }
    }
    return ok;
}
void seq(int n, int type, vi &x){
    if(n==4){
        if(type==1) x={1,3,0,2};
        else x={2,0,3,1};
    } else {
        if(type==1){
            F(i,0,(n+1)/2) x[i]=2*i;
            F(i,0,(n)/2) x[i+(n+1)/2]=2*i+1;
        } else {
            F(i,0,(n)/2) x[i]=2*i+1;
            F(i,0,(n+1)/2) x[i+(n)/2]=2*i;
        }
    }
}
int main(int argc, const char * argv[]) {
    #ifdef LOCAL_TEST
    freopen("input", "r", stdin);
    freopen("output", "w", stdout);
    #endif
    int n,m;
    cin>>n>>m;
    if(n<4 && m<4){
        vi x(n*m);
        F(i,0,n*m) x[i]=i;
        int ok=0;
        do{
            if(check(n,m,x)) {
                ok=1;
                break;
            }
        }while(next_permutation(all(x)));
        if(ok){
            cout<<"YES\n";
            F(j,0,m) {F(i,0,n) cout<<x[i*m+j]+1<<" "; cout<<"\n";}
        }else
            cout<<"NO\n";
    } else {
        int sw=0;
        if(n>m){
            sw=1;
            swap(n,m);
        }
        if(m>=4){
            vi y1(m),y2(m);
            seq(m,1,y1);
            seq(m,2,y2);
            vvi y(n, vi(m));
            F(i,0,n){
                if(i%2==0) F(j,0,m) y[i][j]=y1[j]+m*i;
                else F(j,0,m) y[i][j]=y2[j]+m*i;
            }
            cout<<"YES\n";
            if(sw)
            F(j,0,m) {F(i,0,n) cout<<y[i][j]+1<<" "; cout<<"\n";}
            else
            F(i,0,n) {F(j,0,m) cout<<y[i][j]+1<<" "; cout<<"\n";}
        }
    }
}


//  Created by Vignesh Manoharan

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <numeric>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const int INF = 1000000000;
const ll LINF = 1e17;
const double PI =3.141592653589793238;
const ll lmod = 1000000007l;
const int mod=1000000007;
const double eps = 0.000001;
#pragma unused(INF, LINF, PI, lmod, mod, eps)

#define F(i,a,n) for(int i=(a);i<(n);i++)

template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){
    for(int i=0;i<(t).size();i++)s<<t[i]<<((i<(t).size()-1)?" ":"");return s; }
template<typename T> ostream& operator<<(ostream &s,set<T> t){for(T x:t) s<<x<<" ";return s; }
template<typename T> istream& operator>>(istream &s,vector<T> &t){
    for(int _i=0;_i<t.size();_i++) s>>t[_i];return s; }

#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()

int check(int n, int m, vi x){
    // neighbours of x= x+1,x-1,x+m,x-m
    int ok=1;
    F(i,0,n) F(j,0,m){
        if(!ok) break;
        set<int> on,cn;
        int curr=x[m*i+j];
        if(i>0) cn.insert(x[m*(i-1)+j]);
        if(i<n-1) cn.insert(x[m*(i+1)+j]);
        if(j>0) cn.insert(x[m*i+j-1]);
        if(j<m-1) cn.insert(x[m*i+j+1]);
        int cr=curr/m,cc=curr%m;
        if(cr>0) on.insert(m*(cr-1)+cc);
        if(cr<n-1) on.insert(m*(cr+1)+cc);
        if(cc>0) on.insert(m*(cr)+cc-1);
        if(cc<m-1) on.insert(m*(cr)+cc+1);
        //cout<<on<<"\n"<<cn<<"\n";
        for(int cne: cn){
            if(on.count(cne)){
                ok=0;
                break;
            }
        }
    }
    return ok;
}
void seq(int n, int type, vi &x){
    if(n==4){
        if(type==1) x={1,3,0,2};
        else x={2,0,3,1};
    } else {
        if(type==1){
            F(i,0,(n+1)/2) x[i]=2*i;
            F(i,0,(n-1)/2) x[i+(n+1)/2]=2*i+1;
        } else {
            F(i,0,(n-1)/2) x[i]=2*i+1;
            F(i,0,(n+1)/2) x[i+(n-1)/2]=2*i;
        }
    }
}
int main(int argc, const char * argv[]) {
    #ifdef LOCAL_TEST
    freopen("input", "r", stdin);
    freopen("output", "w", stdout);
    #endif
    int n,m;
    cin>>n>>m;
    if(n<4 && m<4){
        vi x(n*m);
        F(i,0,n*m) x[i]=i;
        int ok=0;
        do{
            if(check(n,m,x)) {
                ok=1;
                break;
            }
        }while(next_permutation(all(x)));
        if(ok){
            cout<<"YES\n";
            F(j,0,m) {F(i,0,n) cout<<x[i*m+j]+1<<" "; cout<<"\n";}
        }else
            cout<<"NO\n";
    } else {
        int sw=0;
        if(n>m){
            sw=1;
            swap(n,m);
        }
        if(m>=4){
            vi y1(m),y2(m);
            seq(m,1,y1);
            seq(m,2,y2);
            vvi y(n, vi(m));
            F(i,0,n){
                if(i%2==0) F(j,0,m) y[i][j]=y1[j]+m*i;
                else F(j,0,m) y[i][j]=y2[j]+m*i;
            }
            cout<<"YES\n";
            if(sw)
            F(j,0,m) {F(i,0,n) cout<<y[i][j]+1<<" "; cout<<"\n";}
            else
            F(i,0,n) {F(j,0,m) cout<<y[i][j]+1<<" "; cout<<"\n";}
        }
    }
}


//  Created by Vignesh Manoharan

#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <numeric>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const int INF = 1000000000;
const ll LINF = 1e17;
const double PI =3.141592653589793238;
const ll lmod = 1000000007l;
const int mod=1000000007;
const double eps = 0.000001;
#pragma unused(INF, LINF, PI, lmod, mod, eps)

#define F(i,a,n) for(int i=(a);i<(n);i++)

template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
template<typename T> ostream& operator<<(ostream &s,vector<T> t){
    for(int i=0;i<(t).size();i++)s<<t[i]<<((i<(t).size()-1)?" ":"");return s; }
template<typename T> ostream& operator<<(ostream &s,set<T> t){for(T x:t) s<<x<<" ";return s; }
template<typename T> istream& operator>>(istream &s,vector<T> &t){
    for(int _i=0;_i<t.size();_i++) s>>t[_i];return s; }

#define pb push_back
#define mp make_pair
#define all(v) v.begin(),v.end()

int check(int n, int m, vi x){
    // neighbours of x= x+1,x-1,x+m,x-m
    int ok=1;
    F(i,0,n) F(j,0,m){
        if(!ok) break;
        set<int> on,cn;
        int curr=x[m*i+j];
        if(i>0) cn.insert(x[m*(i-1)+j]);
        if(i<n-1) cn.insert(x[m*(i+1)+j]);
        if(j>0) cn.insert(x[m*i+j-1]);
        if(j<m-1) cn.insert(x[m*i+j+1]);
        int cr=curr/m,cc=curr%m;
        if(cr>0) on.insert(m*(cr-1)+cc);
        if(cr<n-1) on.insert(m*(cr+1)+cc);
        if(cc>0) on.insert(m*(cr)+cc-1);
        if(cc<m-1) on.insert(m*(cr)+cc+1);
        //cout<<on<<"\n"<<cn<<"\n";
        for(int cne: cn){
            if(on.count(cne)){
                ok=0;
                break;
            }
        }
    }
    return ok;
}
void seq(int n, int type, vi &x){
    if(n==4){
        if(type==1) x={1,3,0,2};
        else x={2,0,3,1};
    } else {
        if(type==1){
            F(i,0,(n+1)/2) x[i]=2*i;
            F(i,0,(n)/2) x[i+(n+1)/2]=2*i+1;
        } else {
            F(i,0,(n)/2) x[i]=2*i+1;
            F(i,0,(n+1)/2) x[i+(n)/2]=2*i;
        }
    }
}
int main(int argc, const char * argv[]) {
    #ifdef LOCAL_TEST
    freopen("input", "r", stdin);
    freopen("output", "w", stdout);
    #endif
    int n,m;
    cin>>n>>m;
    if(n<4 && m<4){
        vi x(n*m);
        F(i,0,n*m) x[i]=i;
        int ok=0;
        do{
            if(check(n,m,x)) {
                ok=1;
                break;
            }
        }while(next_permutation(all(x)));
        if(ok && (n*m!=1)){
            cout<<"YES\n";
            F(j,0,m) {F(i,0,n) cout<<x[i*m+j]+1<<" "; cout<<"\n";}
        }else
            cout<<"NO\n";
    } else {
        int sw=0;
        if(n>m){
            sw=1;
            swap(n,m);
        }
        if(m>=4){
            vi y1(m),y2(m);
            seq(m,1,y1);
            seq(m,2,y2);
            vvi y(n, vi(m));
            F(i,0,n){
                if(i%2==0) F(j,0,m) y[i][j]=y1[j]+m*i;
                else F(j,0,m) y[i][j]=y2[j]+m*i;
            }
            cout<<"YES\n";
            if(sw)
            F(j,0,m) {F(i,0,n) cout<<y[i][j]+1<<" "; cout<<"\n";}
            else
            F(i,0,n) {F(j,0,m) cout<<y[i][j]+1<<" "; cout<<"\n";}
        }
    }
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define null NULL
#define PI M_PI
#define sc(x) scanf("%d", &x)
#define sc64(x) scanf("%I64d", &x)
#define pr(x) printf("%d", x)
#define sp putchar(' ')
#define ln putchar('\n')
#define pr64(x) printf("%I64d", x)
#define rep(i,n) for (int i = 1;i <= (n); ++i)
#define repr(i,n) for (int i = (n);i > 0; --i)
#define repab(i,a,b) for (int i = a;i <= b; ++i)
#define reprab(i,a,b) for (int i = b;i >= a; --i)
#define Rep(i,n) for (int i = 0;i < (n); ++i)
#define Repr(i,n) for (int i = (n)-1;i >= 0; --i)
#define Repab(i,a,b) for (int i = a;i < b; ++i)
#define fi first
#define se second
#define SET(__set, val) memset(__set, val, sizeof __set)
#define prf(x) printf("%.20f", x)
typedef double db;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;

template<class T> T gcd(T a, T b){if(!b)return a;return gcd(b,a%b);}
template<class T> T power(T a, T b){T res(1);while(b){if(b&1)res=res*a;a=a*a;b>>=1;}return res;}
template<class T> T powerM(T a, T b, T mod){T res(1);while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

const int infi = 2147483647;
const ll infl = 9223372036854775807;

#define N 1000
#define M 1000
/*
struct E{
	int v, w, n;
}G[M];
int cnt, point[N];
void add(int u, int v, int w = 0){
	G[++cnt]=(E){v,w,point[u]},point[u]=cnt;
	G[++cnt]=(E){u,w,point[v]},point[v]=cnt;
}
void Ginit(){
	cnt = 0;
	SET(point,0);
}
*/
/*
struct hh{
	int a, b;
	bool operator < (const hh &x) const{
		if(a==x.a)return b<x.b;
		return a<x.a;
	}
}a[N];
*/
int n, m, k, T, ok;
int p[100100];
int q[100100];
int a(int x, int y){
	return p[(x-1)*(m)+y];
}
int d;
bool check1(int val1, int val){
	int q = val%m;
	if(q==1){
		if(val1==val+1)return 0;
	}else
	if(q==0){
		if(val1==val-1)return 0;
	}else{
		if(abs(val1-val)==1)
			return 0;
	}
	if(abs(val1-val)==m)
		return 0;
	return 1;
}
bool check(){
	//i -> i+1 i-1 i-m i+m
	rep(i,k){
		int x = (i-1)/m+1;
		int y = (i%m)==0?m:i%m;
		if(x>1){
			d = a(x-1,y);
			if(!check1(d,p[i]))return 0;
		}
		if(x<n){
			d = a(x+1,y);
			if(!check1(d,p[i]))return 0;
		}
		if(y>1){
			d = a(x,y-1);
			if(!check1(d,p[i]))return 0;
		}
		if(y<m){
			d = a(x,y+1);
			if(!check1(d,p[i]))return 0;
		}
	}
	return 1;
}
int vis[100100];
int dfs(int t){
	if(t>k){
		if(check()){
			ok = 1;
			return 1;
		}
	}
	rep(i,k)if(!vis[i]){
		p[t] = i;
		vis[i] = 1;
		if(dfs(t+1))return 1;
		vis[i] = 0;
	}
	return 0;
}
void print(int flag){
	if(!flag){
		rep(i,n){
			rep(j,m)pr(a(i,j)),sp;
			puts("");
		}
	}else{
		rep(i,m){
			rep(j,n)pr(a(j,i)),sp;
			puts("");
		}
	}
}
const int hh[] = {0,2,4,1,3};
const int hh1[] = {0,3,1,4,2};
int main(){
//	freopen("1", "r", stdin);
//	freopen("2", "w", stdout);
	sc(n),sc(m);
	int flag = 0;
	if(n>m)swap(n,m),flag = 1;
	if(m<=3){
		ok = 0;
		k = n*m;
		dfs(1);
		if(ok){
			puts("YES");
			print(flag);
		}else{
			puts("NO");
		}
	}else{
		puts("YES");
		if(m<5){
			if(flag){
				rep(i,m){
					rep(j,n){
						if(j&1)pr((j-1)*m+hh[i]);
						else pr((j-1)*m+hh1[i]);
						sp;
					}
					ln;
				}
			}else{
				rep(i,n){
					if(i&1){
						rep(j,m)pr((i-1)*m+hh[j]),sp;
						ln;
					}
					else{
						rep(j,m)pr((i-1)*m+hh1[j]),sp;
						ln;
					}
				}
			}
		}else{
			int t = 0;
			rep(i,m)if(i&1)p[++t] = i;
			rep(i,m)if(!(i&1))p[++t] = i;
			rep(i,m)q[i] = p[i+1];
			q[m] = p[1];
			if(flag){
				rep(i,m){
					rep(j,n){
						if(j&1)pr((j-1)*m+p[i]);
						else pr((j-1)*m+q[i]);
						sp;
					}
					ln;
				}
			}else{
				rep(i,n){
					if(i&1){
						rep(j,m)pr((i-1)*m+p[j]),sp;
						ln;
					}
					else{
						rep(j,m)pr((i-1)*m+q[j]),sp;
						ln;
					}
				}
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define null NULL
#define PI M_PI
#define sc(x) scanf("%d", &x)
#define sc64(x) scanf("%I64d", &x)
#define pr(x) printf("%d", x)
#define sp putchar(' ')
#define ln putchar('\n')
#define pr64(x) printf("%I64d", x)
#define rep(i,n) for (int i = 1;i <= (n); ++i)
#define repr(i,n) for (int i = (n);i > 0; --i)
#define repab(i,a,b) for (int i = a;i <= b; ++i)
#define reprab(i,a,b) for (int i = b;i >= a; --i)
#define Rep(i,n) for (int i = 0;i < (n); ++i)
#define Repr(i,n) for (int i = (n)-1;i >= 0; --i)
#define Repab(i,a,b) for (int i = a;i < b; ++i)
#define fi first
#define se second
#define SET(__set, val) memset(__set, val, sizeof __set)
#define prf(x) printf("%.20f", x)
typedef double db;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;

template<class T> T gcd(T a, T b){if(!b)return a;return gcd(b,a%b);}
template<class T> T power(T a, T b){T res(1);while(b){if(b&1)res=res*a;a=a*a;b>>=1;}return res;}
template<class T> T powerM(T a, T b, T mod){T res(1);while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

const int infi = 2147483647;
const ll infl = 9223372036854775807;

#define N 1000
#define M 1000
/*
struct E{
	int v, w, n;
}G[M];
int cnt, point[N];
void add(int u, int v, int w = 0){
	G[++cnt]=(E){v,w,point[u]},point[u]=cnt;
	G[++cnt]=(E){u,w,point[v]},point[v]=cnt;
}
void Ginit(){
	cnt = 0;
	SET(point,0);
}
*/
/*
struct hh{
	int a, b;
	bool operator < (const hh &x) const{
		if(a==x.a)return b<x.b;
		return a<x.a;
	}
}a[N];
*/
int n, m, k, T, ok;
int p[100100];
int q[100100];
int a(int x, int y){
	return p[(x-1)*(m)+y];
}
int d;
bool check1(int val1, int val){
	int q = val%m;
	if(q==1){
		if(val1==val+1)return 0;
	}else
	if(q==0){
		if(val1==val-1)return 0;
	}else{
		if(abs(val1-val)==1)
			return 0;
	}
	if(abs(val1-val)==m)
		return 0;
	return 1;
}
bool check(){
	//i -> i+1 i-1 i-m i+m
	rep(i,k){
		int x = (i-1)/m+1;
		int y = (i%m)==0?m:i%m;
		if(x>1){
			d = a(x-1,y);
			if(!check1(d,p[i]))return 0;
		}
		if(x<n){
			d = a(x+1,y);
			if(!check1(d,p[i]))return 0;
		}
		if(y>1){
			d = a(x,y-1);
			if(!check1(d,p[i]))return 0;
		}
		if(y<m){
			d = a(x,y+1);
			if(!check1(d,p[i]))return 0;
		}
	}
	return 1;
}
int vis[100100];
int dfs(int t){
	if(t>k){
		if(check()){
			ok = 1;
			return 1;
		}
	}
	rep(i,k)if(!vis[i]){
		p[t] = i;
		vis[i] = 1;
		if(dfs(t+1))return 1;
		vis[i] = 0;
	}
	return 0;
}
void print(int flag){
	if(!flag){
		rep(i,n){
			rep(j,m)pr(a(i,j)),sp;
			puts("");
		}
	}else{
		rep(i,m){
			rep(j,n)pr(a(j,i)),sp;
			puts("");
		}
	}
}
const int hh[] = {0,2,4,1,3};
const int hh1[] = {0,3,1,4,2};
int main(){
//	freopen("1", "r", stdin);
//	freopen("2", "w", stdout);
	sc(n),sc(m);
	int flag = 0;
	if(n>m)swap(n,m),flag = 1;
	if(n*m<=9){
		ok = 0;
		k = n*m;
		dfs(1);
		if(ok){
			puts("YES");
			print(flag);
		}else{
			puts("NO");
		}
	}else{
		puts("YES");
		if(m<5){
			rep(i,n){
				if(i&1){
					rep(j,m)pr((i-1)*m+hh[j]),sp;
					ln;
				}
				else{
					rep(j,m)pr((i-1)*m+hh1[j]),sp;
					ln;
				}
			}
		}else{
			int t = 0;
			rep(i,m)if(i&1)p[++t] = i;
			rep(i,m)if(!(i&1))p[++t] = i;
			rep(i,m)q[i] = p[i+1];
			q[m] = p[1];
			if(flag){
				rep(i,m){
					rep(j,n){
						if(j&1)pr((j-1)*m+p[i]);
						else pr((j-1)*m+q[i]);
						sp;
					}
					ln;
				}
			}else{
				rep(i,n){
					if(i&1){
						rep(j,m)pr((i-1)*m+p[j]),sp;
						ln;
					}
					else{
						rep(j,m)pr((i-1)*m+q[j]),sp;
						ln;
					}
				}
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define null NULL
#define PI M_PI
#define sc(x) scanf("%d", &x)
#define sc64(x) scanf("%I64d", &x)
#define pr(x) printf("%d", x)
#define sp putchar(' ')
#define ln putchar('\n')
#define pr64(x) printf("%I64d", x)
#define rep(i,n) for (int i = 1;i <= (n); ++i)
#define repr(i,n) for (int i = (n);i > 0; --i)
#define repab(i,a,b) for (int i = a;i <= b; ++i)
#define reprab(i,a,b) for (int i = b;i >= a; --i)
#define Rep(i,n) for (int i = 0;i < (n); ++i)
#define Repr(i,n) for (int i = (n)-1;i >= 0; --i)
#define Repab(i,a,b) for (int i = a;i < b; ++i)
#define fi first
#define se second
#define SET(__set, val) memset(__set, val, sizeof __set)
#define prf(x) printf("%.20f", x)
typedef double db;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;

template<class T> T gcd(T a, T b){if(!b)return a;return gcd(b,a%b);}
template<class T> T power(T a, T b){T res(1);while(b){if(b&1)res=res*a;a=a*a;b>>=1;}return res;}
template<class T> T powerM(T a, T b, T mod){T res(1);while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

const int infi = 2147483647;
const ll infl = 9223372036854775807;

#define N 1000
#define M 1000
/*
struct E{
	int v, w, n;
}G[M];
int cnt, point[N];
void add(int u, int v, int w = 0){
	G[++cnt]=(E){v,w,point[u]},point[u]=cnt;
	G[++cnt]=(E){u,w,point[v]},point[v]=cnt;
}
void Ginit(){
	cnt = 0;
	SET(point,0);
}
*/
/*
struct hh{
	int a, b;
	bool operator < (const hh &x) const{
		if(a==x.a)return b<x.b;
		return a<x.a;
	}
}a[N];
*/
int n, m, k, T, ok;
int p[100100];
int q[100100];
int a(int x, int y){
	return p[(x-1)*(m)+y];
}
int d;
bool check1(int val1, int val){
	int q = val%m;
	if(q==1){
		if(val1==val+1)return 0;
	}else
	if(q==0){
		if(val1==val-1)return 0;
	}else{
		if(abs(val1-val)==1)
			return 0;
	}
	if(abs(val1-val)==m)
		return 0;
	return 1;
}
bool check(){
	//i -> i+1 i-1 i-m i+m
	rep(i,k){
		int x = (i-1)/m+1;
		int y = (i%m)==0?m:i%m;
		if(x>1){
			d = a(x-1,y);
			if(!check1(d,p[i]))return 0;
		}
		if(x<n){
			d = a(x+1,y);
			if(!check1(d,p[i]))return 0;
		}
		if(y>1){
			d = a(x,y-1);
			if(!check1(d,p[i]))return 0;
		}
		if(y<m){
			d = a(x,y+1);
			if(!check1(d,p[i]))return 0;
		}
	}
	return 1;
}
int vis[100100];
int dfs(int t){
	if(t>k){
		if(check()){
			ok = 1;
			return 1;
		}
	}
	rep(i,k)if(!vis[i]){
		p[t] = i;
		vis[i] = 1;
		if(dfs(t+1))return 1;
		vis[i] = 0;
	}
	return 0;
}
void print(int flag){
	if(!flag){
		rep(i,n){
			rep(j,m)pr(a(i,j)),sp;
			puts("");
		}
	}else{
		rep(i,m){
			rep(j,n)pr(a(j,i)),sp;
			puts("");
		}
	}
}
const int hh[] = {0,2,4,1,3};
const int hh1[] = {0,3,1,4,2};
int main(){
//	freopen("1", "r", stdin);
//	freopen("2", "w", stdout);
	sc(n),sc(m);
	int flag = 0;
	if(n>m)swap(n,m),flag = 1;
	if(m<=3){
		ok = 0;
		k = n*m;
		dfs(1);
		if(ok){
			puts("YES");
			print(flag);
		}else{
			puts("NO");
		}
	}else{
		puts("YES");
		if(m<5){
			rep(i,n){
				if(i&1){
					rep(j,m)pr((i-1)*m+hh[j]),sp;
					ln;
				}
				else{
					rep(j,m)pr((i-1)*m+hh1[j]),sp;
					ln;
				}
			}
		}else{
			int t = 0;
			rep(i,m)if(i&1)p[++t] = i;
			rep(i,m)if(!(i&1))p[++t] = i;
			rep(i,m)q[i] = p[i+1];
			q[m] = p[1];
			if(flag){
				rep(i,m){
					rep(j,n){
						if(j&1)pr((j-1)*m+p[i]);
						else pr((j-1)*m+q[i]);
						sp;
					}
					ln;
				}
			}else{
				rep(i,n){
					if(i&1){
						rep(j,m)pr((i-1)*m+p[j]),sp;
						ln;
					}
					else{
						rep(j,m)pr((i-1)*m+q[j]),sp;
						ln;
					}
				}
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define null NULL
#define PI M_PI
#define sc(x) scanf("%d", &x)
#define sc64(x) scanf("%I64d", &x)
#define pr(x) printf("%d", x)
#define sp putchar(' ')
#define ln putchar('\n')
#define pr64(x) printf("%I64d", x)
#define rep(i,n) for (int i = 1;i <= (n); ++i)
#define repr(i,n) for (int i = (n);i > 0; --i)
#define repab(i,a,b) for (int i = a;i <= b; ++i)
#define reprab(i,a,b) for (int i = b;i >= a; --i)
#define Rep(i,n) for (int i = 0;i < (n); ++i)
#define Repr(i,n) for (int i = (n)-1;i >= 0; --i)
#define Repab(i,a,b) for (int i = a;i < b; ++i)
#define fi first
#define se second
#define SET(__set, val) memset(__set, val, sizeof __set)
#define prf(x) printf("%.20f", x)
typedef double db;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;

template<class T> T gcd(T a, T b){if(!b)return a;return gcd(b,a%b);}
template<class T> T power(T a, T b){T res(1);while(b){if(b&1)res=res*a;a=a*a;b>>=1;}return res;}
template<class T> T powerM(T a, T b, T mod){T res(1);while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

const int infi = 2147483647;
const ll infl = 9223372036854775807;

#define N 1000
#define M 1000
/*
struct E{
	int v, w, n;
}G[M];
int cnt, point[N];
void add(int u, int v, int w = 0){
	G[++cnt]=(E){v,w,point[u]},point[u]=cnt;
	G[++cnt]=(E){u,w,point[v]},point[v]=cnt;
}
void Ginit(){
	cnt = 0;
	SET(point,0);
}
*/
/*
struct hh{
	int a, b;
	bool operator < (const hh &x) const{
		if(a==x.a)return b<x.b;
		return a<x.a;
	}
}a[N];
*/
int n, m, k, T, ok;
int p[100100];
int q[100100];
int a(int x, int y){
	return p[(x-1)*(m)+y];
}
int d;
bool check1(int val1, int val){
	int q = val%m;
	if(q==1){
		if(val1==val+1)return 0;
	}else
	if(q==0){
		if(val1==val-1)return 0;
	}else{
		if(abs(val1-val)==1)
			return 0;
	}
	if(abs(val1-val)==m)
		return 0;
	return 1;
}
bool check(){
	//i -> i+1 i-1 i-m i+m
	rep(i,k){
		int x = (i-1)/m+1;
		int y = (i%m)==0?m:i%m;
		if(x>1){
			d = a(x-1,y);
			if(!check1(d,p[i]))return 0;
		}
		if(x<n){
			d = a(x+1,y);
			if(!check1(d,p[i]))return 0;
		}
		if(y>1){
			d = a(x,y-1);
			if(!check1(d,p[i]))return 0;
		}
		if(y<m){
			d = a(x,y+1);
			if(!check1(d,p[i]))return 0;
		}
	}
	return 1;
}
int vis[100100];
int dfs(int t){
	if(t>k){
		if(check()){
			ok = 1;
			return 1;
		}
	}
	rep(i,k)if(!vis[i]){
		p[t] = i;
		vis[i] = 1;
		if(dfs(t+1))return 1;
		vis[i] = 0;
	}
	return 0;
}
void print(){
	rep(i,n){
		rep(j,m)pr(a(i,j)),sp;
		puts("");
	}
}
const int hh[] = {0,2,4,1,3};
const int hh1[] = {0,3,1,4,2};

int main(){
//	freopen("1", "r", stdin);
//	freopen("2", "w", stdout);
	sc(n),sc(m);
	int flag = 0;
	int upp = max(n,m), low = min(n,m);
	if(upp<=3){
		ok = 0;
		k = n*m;
		dfs(1);
		if(ok){
			puts("YES");
			print();
		}else{
			puts("NO");
		}
	}else{
		puts("YES");
		if(upp<5){
			if(n>=m){
				rep(i,n){
					rep(j,m){
						if(j&1)pr(j+(hh[i]-1)*m);
						else pr(j+(hh1[i]-1)*m);
						sp;
					}
					ln;
				}
			}else{
				rep(i,n){
					if(i&1){
						rep(j,m)pr((i-1)*m+hh[j]),sp;
						ln;
					}
					else{
						rep(j,m)pr((i-1)*m+hh1[j]),sp;
						ln;
					}
				}
			}
		}else{
			int t = 0;
			if(n>=m){
				rep(i,n)if(i&1)p[++t] = i;
				rep(i,n)if(!(i&1))p[++t] = i;
				rep(i,n)q[i] = p[i+1];
				q[n] = p[1];
				rep(i,n){
					rep(j,m){
						if(j&1)pr(j+(p[i]-1)*m);
						else pr(j+(q[i]-1)*m);
						sp;
					}
					ln;
				}
			}else{
				rep(i,m)if(i&1)p[++t] = i;
				rep(i,m)if(!(i&1))p[++t] = i;
				rep(i,m)q[i] = p[i+1];
				q[m] = p[1];
				rep(i,n){
					if(i&1){
						rep(j,m)pr((i-1)*m+p[j]),sp;
						ln;
					}
					else{
						rep(j,m)pr((i-1)*m+q[j]),sp;
						ln;
					}
				}
			}
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define null NULL
#define PI M_PI
#define sc(x) scanf("%d", &x)
#define sc64(x) scanf("%I64d", &x)
#define pr(x) printf("%d", x)
#define sp putchar(' ')
#define ln putchar('\n')
#define pr64(x) printf("%I64d", x)
#define rep(i,n) for (int i = 1;i <= (n); ++i)
#define repr(i,n) for (int i = (n);i > 0; --i)
#define repab(i,a,b) for (int i = a;i <= b; ++i)
#define reprab(i,a,b) for (int i = b;i >= a; --i)
#define Rep(i,n) for (int i = 0;i < (n); ++i)
#define Repr(i,n) for (int i = (n)-1;i >= 0; --i)
#define Repab(i,a,b) for (int i = a;i < b; ++i)
#define fi first
#define se second
#define SET(__set, val) memset(__set, val, sizeof __set)
#define prf(x) printf("%.20f", x)
typedef double db;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;

template<class T> T gcd(T a, T b){if(!b)return a;return gcd(b,a%b);}
template<class T> T power(T a, T b){T res(1);while(b){if(b&1)res=res*a;a=a*a;b>>=1;}return res;}
template<class T> T powerM(T a, T b, T mod){T res(1);while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;}

const int infi = 2147483647;
const ll infl = 9223372036854775807;

#define N 1000
#define M 1000
/*
struct E{
	int v, w, n;
}G[M];
int cnt, point[N];
void add(int u, int v, int w = 0){
	G[++cnt]=(E){v,w,point[u]},point[u]=cnt;
	G[++cnt]=(E){u,w,point[v]},point[v]=cnt;
}
void Ginit(){
	cnt = 0;
	SET(point,0);
}
*/
/*
struct hh{
	int a, b;
	bool operator < (const hh &x) const{
		if(a==x.a)return b<x.b;
		return a<x.a;
	}
}a[N];
*/
int n, m, k, T, ok;
int p[100100];
int q[100100];
int a(int x, int y){
	return p[(x-1)*(m)+y];
}
int d;
bool check1(int val1, int val){
	int q = val%m;
	if(q>1 && q < m){
		if(abs(val1-val)==1)
			return 0;
	}
	if(abs(val1-val)==m)
		return 0;
	return 1;
}
bool check(){
	//i -> i+1 i-1 i-m i+m
	rep(i,k){
		int x = (i-1)/m+1;
		int y = (i%m)==0?m:i%m;
		if(x>1){
			d = a(x-1,y);
			if(!check1(d,p[i]))return 0;
		}
		if(x<n){
			d = a(x+1,y);
			if(!check1(d,p[i]))return 0;
		}
		if(y>1){
			d = a(x,y-1);
			if(!check1(d,p[i]))return 0;
		}
		if(y<m){
			d = a(x,y+1);
			if(!check1(d,p[i]))return 0;
		}
	}
	return 1;
}
int vis[100100];
int dfs(int t){
	if(t>k){
		if(check()){
			ok = 1;
			return 1;
		}
	}
	rep(i,k)if(!vis[i]){
		p[t] = i;
		vis[i] = 1;
		if(dfs(t+1))return 1;
		vis[i] = 0;
	}
	return 0;
}
void print(int flag){
	if(!flag){
		rep(i,n){
			rep(j,m)pr(a(i,j)),sp;
			puts("");
		}
	}else{
		rep(i,m){
			rep(j,n)pr(a(j,i)),sp;
			puts("");
		}
	}
}
const int hh[] = {0,2,4,1,3};
const int hh1[] = {0,3,1,4,2};
int main(){
//	freopen("1", "r", stdin);
//	freopen("2", "w", stdout);
	sc(n),sc(m);
	int flag = 0;
	if(n>m)swap(n,m),flag = 1;
	if(n*m<=9){
		ok = 0;
		k = n*m;
		dfs(1);
		if(ok){
			puts("YES");
			print(flag);
		}else{
			puts("NO");
		}
	}else{
		puts("YES");
		if(m<5){
			rep(i,n){
				if(i&1){
					rep(j,m)pr((i-1)*m+hh[j]),sp;
					ln;
				}
				else{
					rep(j,m)pr((i-1)*m+hh1[j]),sp;
					ln;
				}
			}
		}else{
			int t = 0;
			rep(i,m)if(i&1)p[++t] = i;
			rep(i,m)if(!(i&1))p[++t] = i;
			rep(i,m)q[i] = p[i+1];
			q[m] = p[1];
			rep(i,n){
				if(i&1){
					rep(j,m)pr((i-1)*m+p[j]),sp;
					ln;
				}
				else{
					rep(j,m)pr((i-1)*m+q[j]),sp;
					ln;
				}
			}
		}
	}
	return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
const int M=1e9+7;
#define pb push_back
ll powmod(ll a,ll b) {ll res=1;a%=M; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%M;a=a*a%M;}return res%M;}/* a^b%M */
const int N=1e5+1;

int main()
{
    int n,m;
    cin>>n>>m;
    if(n==1&&m==1)
    {
        cout<<"YES\n";
        cout<<"1\n";
        return 0;
    }
    if(n<=m){
    int a[n+1][m+1];
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j)a[i][j]=(i-1)*m + j;
    int ans[n+1][m+1];
    for(int i=1;i<=n;++i)
    {
        if(i&1)
        {
            int k=0;
            for(int j=2;j<=m;j+=2)
                ans[i][++k]=a[i][j];
            for(int j=1;j<=m;j+=2)
                ans[i][++k]=a[i][j];
        }
        else
        {
            if(m%2==0){
            int k=m+1;
            for(int j=2;j<=m;j+=2)
                ans[i][--k]=a[i][j];
            for(int j=1;j<=m;j+=2)
                ans[i][--k]=a[i][j];
            }
            else
            {
                int k=0;
                for(int j=1;j<=m;j+=2)
                    ans[i][++k]=a[i][j];
                for(int j=2;j<=m;j+=2)
                    ans[i][++k]=a[i][j];
            }
        }
    }
    /*cout<<"lol\n";
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=m;++j)
        {
            printf("%d ",ans[i][j]);
        }
        printf("\n");
    }
    cout<<"lol\n";*/
    int dx[]={1,0,-1,0};
    int dy[]={0,1,0,-1};
    set<int>s[101];
    if(m<=10&&n<=10)
    {
        bool ok=1;
        for(int i=1;i<=n;++i)
        {
            for(int j=1;j<=m;++j)
            {
                for(int k=0;k<4;++k)
                {
                    int r=i+dx[k];
                    int c=j+dy[k];
                    if(r>=1&&r<=n&&c>=1&c<=m)
                    {
                        s[a[i][j]].insert(a[r][c]);
                    }
                }
            }
        }
        for(int i=1;i<=n;++i)
        {
            for(int j=1;j<=m;++j)
            {
                for(int k=0;k<4;++k)
                {
                    int r=i+dx[k];
                    int c=j+dy[k];
                    if(r>=1&&r<=n&&c>=1&c<=m)
                    {
                        for(set<int>::iterator it=s[ans[i][j]].begin();it!=s[ans[i][j]].end();++it)
                        {
                            if(*it==ans[r][c])ok=0;
                        }
                    }
                }
            }
        }
        if(ok==0)
        {
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=m;++j)
        {
            printf("%d ",ans[i][j]);
        }
        printf("\n");
    }
    }
    else
    {
        swap(n,m);
        int a[n+1][m+1];
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j)a[i][j]=(j-1)*n + i;
    int ans[n+1][m+1];
    for(int i=1;i<=n;++i)
    {
        if(i&1)
        {
            int k=0;
            for(int j=2;j<=m;j+=2)
                ans[i][++k]=a[i][j];
            for(int j=1;j<=m;j+=2)
                ans[i][++k]=a[i][j];
        }
        else
        {
            if(m%2==0){
            int k=m+1;
            for(int j=2;j<=m;j+=2)
                ans[i][--k]=a[i][j];
            for(int j=1;j<=m;j+=2)
                ans[i][--k]=a[i][j];
            }
            else
            {
                int k=0;
                for(int j=1;j<=m;j+=2)
                    ans[i][++k]=a[i][j];
                for(int j=2;j<=m;j+=2)
                    ans[i][++k]=a[i][j];
            }
        }
    }
    /*cout<<"lol\n";
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=m;++j)
        {
            printf("%d ",ans[i][j]);
        }
        printf("\n");
    }
    cout<<"lol\n";*/
    int dx[]={1,0,-1,0};
    int dy[]={0,1,0,-1};
    set<int>s[101];
    if(m<=10&&n<=10)
    {
        bool ok=1;
        for(int i=1;i<=n;++i)
        {
            for(int j=1;j<=m;++j)
            {
                for(int k=0;k<4;++k)
                {
                    int r=i+dx[k];
                    int c=j+dy[k];
                    if(r>=1&&r<=n&&c>=1&c<=m)
                    {
                        s[a[i][j]].insert(a[r][c]);
                    }
                }
            }
        }
        for(int i=1;i<=n;++i)
        {
            for(int j=1;j<=m;++j)
            {
                for(int k=0;k<4;++k)
                {
                    int r=i+dx[k];
                    int c=j+dy[k];
                    if(r>=1&&r<=n&&c>=1&c<=m)
                    {
                        for(set<int>::iterator it=s[ans[i][j]].begin();it!=s[ans[i][j]].end();++it)
                        {
                            if(*it==ans[r][c])ok=0;
                        }
                    }
                }
            }
        }
        if(ok==0)
        {
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    for(int i=1;i<=m;++i)
    {
        for(int j=1;j<=n;++j)
        {
            printf("%d ",ans[j][i]);
        }
        printf("\n");
    }
    }
    return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
const int M=1e9+7;
#define pb push_back
ll powmod(ll a,ll b) {ll res=1;a%=M; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%M;a=a*a%M;}return res%M;}/* a^b%M */
const int N=1e5+1;

int main()
{
    int n,m;
    cin>>n>>m;
    if(n==1&&m==1)
    {
        cout<<"YES\n";
        cout<<"1\n";
        return 0;
    }
    if(n==3&&m==3)
    {
        puts("YES");
        printf("6 1 8\n7 5 3\n2 9 4\n");
        return 0;
    }
    if(n<=m){
    int a[n+1][m+1];
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j)a[i][j]=(i-1)*m + j;
    int ans[n+1][m+1];
    for(int i=1;i<=n;++i)
    {
        if(i&1)
        {
            int k=0;
            for(int j=2;j<=m;j+=2)
                ans[i][++k]=a[i][j];
            for(int j=1;j<=m;j+=2)
                ans[i][++k]=a[i][j];
        }
        else
        {
            if(m%2==0){
            int k=m+1;
            for(int j=2;j<=m;j+=2)
                ans[i][--k]=a[i][j];
            for(int j=1;j<=m;j+=2)
                ans[i][--k]=a[i][j];
            }
            else
            {
                int k=0;
                for(int j=1;j<=m;j+=2)
                    ans[i][++k]=a[i][j];
                for(int j=2;j<=m;j+=2)
                    ans[i][++k]=a[i][j];
            }
        }
    }
    /*cout<<"lol\n";
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=m;++j)
        {
            printf("%d ",ans[i][j]);
        }
        printf("\n");
    }
    cout<<"lol\n";*/
    int dx[]={1,0,-1,0};
    int dy[]={0,1,0,-1};
    set<int>s[101];
    if(m<=10&&n<=10)
    {
        bool ok=1;
        for(int i=1;i<=n;++i)
        {
            for(int j=1;j<=m;++j)
            {
                for(int k=0;k<4;++k)
                {
                    int r=i+dx[k];
                    int c=j+dy[k];
                    if(r>=1&&r<=n&&c>=1&c<=m)
                    {
                        s[a[i][j]].insert(a[r][c]);
                    }
                }
            }
        }
        for(int i=1;i<=n;++i)
        {
            for(int j=1;j<=m;++j)
            {
                for(int k=0;k<4;++k)
                {
                    int r=i+dx[k];
                    int c=j+dy[k];
                    if(r>=1&&r<=n&&c>=1&c<=m)
                    {
                        for(set<int>::iterator it=s[ans[i][j]].begin();it!=s[ans[i][j]].end();++it)
                        {
                            if(*it==ans[r][c])ok=0;
                        }
                    }
                }
            }
        }
        if(ok==0)
        {
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=m;++j)
        {
            printf("%d ",ans[i][j]);
        }
        printf("\n");
    }
    }
    else
    {
        swap(n,m);
        int a[n+1][m+1];
    for(int i=1;i<=n;++i)
        for(int j=1;j<=m;++j)a[i][j]=(j-1)*n + i;
    int ans[n+1][m+1];
    for(int i=1;i<=n;++i)
    {
        if(i&1)
        {
            int k=0;
            for(int j=2;j<=m;j+=2)
                ans[i][++k]=a[i][j];
            for(int j=1;j<=m;j+=2)
                ans[i][++k]=a[i][j];
        }
        else
        {
            if(m%2==0){
            int k=m+1;
            for(int j=2;j<=m;j+=2)
                ans[i][--k]=a[i][j];
            for(int j=1;j<=m;j+=2)
                ans[i][--k]=a[i][j];
            }
            else
            {
                int k=0;
                for(int j=1;j<=m;j+=2)
                    ans[i][++k]=a[i][j];
                for(int j=2;j<=m;j+=2)
                    ans[i][++k]=a[i][j];
            }
        }
    }
    /*cout<<"lol\n";
    for(int i=1;i<=n;++i)
    {
        for(int j=1;j<=m;++j)
        {
            printf("%d ",ans[i][j]);
        }
        printf("\n");
    }
    cout<<"lol\n";*/
    int dx[]={1,0,-1,0};
    int dy[]={0,1,0,-1};
    set<int>s[101];
    if(m<=10&&n<=10)
    {
        bool ok=1;
        for(int i=1;i<=n;++i)
        {
            for(int j=1;j<=m;++j)
            {
                for(int k=0;k<4;++k)
                {
                    int r=i+dx[k];
                    int c=j+dy[k];
                    if(r>=1&&r<=n&&c>=1&c<=m)
                    {
                        s[a[i][j]].insert(a[r][c]);
                    }
                }
            }
        }
        for(int i=1;i<=n;++i)
        {
            for(int j=1;j<=m;++j)
            {
                for(int k=0;k<4;++k)
                {
                    int r=i+dx[k];
                    int c=j+dy[k];
                    if(r>=1&&r<=n&&c>=1&c<=m)
                    {
                        for(set<int>::iterator it=s[ans[i][j]].begin();it!=s[ans[i][j]].end();++it)
                        {
                            if(*it==ans[r][c])ok=0;
                        }
                    }
                }
            }
        }
        if(ok==0)
        {
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    for(int i=1;i<=m;++i)
    {
        for(int j=1;j<=n;++j)
        {
            printf("%d ",ans[j][i]);
        }
        printf("\n");
    }
    }
    return 0;
}


#include <bits/stdc++.h>
 #define int long long
using namespace std;
const int maxn = 2e5 + 7;

int n, m;
vector<int> adj[maxn];
vector<int> arr[maxn], cur[maxn];
bool used[maxn];

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

int myrand()
{
	int x = ((1LL * rand() * (1LL << 20) + rand()) % (n * m)) + 1;
	return x;
}

bool check(int x, int i, int j){
	if(i <= 0 || j <= 0)
		return 0;

	for(int v : adj[x]){
		if(v == cur[i][j])
			return 1;
	}
	return 0;
}

void solve(){
	int num = 0;

	for(int i = 1; i <= n; i++)
    {
		for(int j = 1; j <= m; j++)
        {
			num = 0;
			int x = myrand();
			while( (num < (n * m + 1000)) && (used[x] == 1 || check(x, i - 1, j) || check(x, i, j - 1))){
				x = myrand();
				num++;
			}

			if(num >= (n * m + 1000))
				return;

			used[x] = 1;
			cur[i][j] = x;
		}
	}
    cout << "YES" << '\n';
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= m; j++){
			printf("%d ", cur[i][j]);
		}
		cout << '\n';
	}
	exit(0);
}

int32_t main()
{
	srand(44);
    cin >> n >> m;
	for(int i = 1; i <= n; i++)
    {
		arr[i].resize(m + 10);
		cur[i].resize(m + 10);

		for(int j = 1; j <= m; j++)
			arr[i][j] = (i - 1) * m + j;
	}

	for(int i = 1; i <= n; i++)
    {
		for(int j = 1; j <= m; j++)
        {
			for(int k = 0; k < 4; k++)
            {
				int nx = i + dx[k];
				int ny = j + dy[k];

				if(nx >= 1 && nx <= n && ny >= 1 && ny <= m)
					adj[arr[i][j]].push_back(arr[nx][ny]);
			}
		}
	}

	for(int i = 0; i < 70; i++)
    {
		memset(used, 0, sizeof(used));
		solve();
	}
    cout << "NO";
	return 0;
}


//
// Created by ichiro on 12/27/17.
//
#include<bits/stdc++.h>

using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 1e6 + 7;
typedef long long ll;

int n, m, num;
int map1[10000][1000];
bool flag[maxn];
bool check(int a, int x, int y) {
    if (map1[x - 1][y] == a + 1 || map1[x - 1][y] == a - 1) {
        return false;
    }
    if (map1[x + 1][y] == a + 1 || map1[x + 1][y] == a - 1) {
        return false;
    }
    if (map1[x][y - 1] == a + 1 || map1[x][y - 1] == a - 1) {
        return false;
    }
    if (map1[x][y + 1] == a + 1 || map1[x][y + 1] == a - 1) {
        return false;
    }
    return true;
}

void dfs(int a, int x, int y) {

    map1[x][y] = a;
    flag[a] = false;

    bool f = false;
    for (int i = 1; i <= num; i++) {
        if (flag[i]) {
            f = true;
            break;
        }
    }
    if (!f) {
        printf("YES\n");
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                printf("%d", map1[i][j]);
                if (j != m)printf(" ");
            }
            printf("\n");
        }
        exit(0);
    }

    if (map1[x + 1][y] == -1 && x + 1 <= n) {
        for (int i = 1; i <= num; i++) {
            if (flag[i] && check(i, x + 1, y)) {
                dfs(i, x + 1, y);
            }

        }
    }
    if (map1[x - 1][y] == -1 && x - 1 >= 1) {
        for (int i = 1; i <= num; i++) {
            if (flag[i] && check(i, x - 1, y)) {
                dfs(i, x - 1, y);
            }
        }
    }
    if (map1[x][y - 1] == -1 && y - 1 >= 1) {
        for (int i = 1; i <= num; i++) {
            if (flag[i] && check(i, x, y - 1)) {
                dfs(i, x, y - 1);
            }
        }
    }
    if (map1[x][y + 1] == -1 && y + 1 <= m) {
        for (int i = 1; i <= num; i++) {
            if (flag[i] && check(i, x, y + 1)) {
                dfs(i, x, y + 1);
            }
        }
    }

    map1[x][y] = -1;
    flag[a] = true;
}

int main() {

#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
#endif

    scanf("%d%d", &n, &m);
    num = n * m;

    memset(map1, -1, sizeof(map1));
    memset(flag, 0x3f, sizeof(flag));

    dfs(1, 1, 1);

    printf("NO\n");

    return 0;
}


//
// Created by ichiro on 12/27/17.
//
#include<bits/stdc++.h>

using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 1e6 + 7;
typedef long long ll;

int n, m, num;
int map1[10000][10000];
bool flag[maxn];
bool check(int a, int x, int y) {
    if (map1[x - 1][y] == a + 1 || map1[x - 1][y] == a - 1) {
        return false;
    }
    if (map1[x + 1][y] == a + 1 || map1[x + 1][y] == a - 1) {
        return false;
    }
    if (map1[x][y - 1] == a + 1 || map1[x][y - 1] == a - 1) {
        return false;
    }
    if (map1[x][y + 1] == a + 1 || map1[x][y + 1] == a - 1) {
        return false;
    }
    return true;
}

void dfs(int a, int x, int y) {

    map1[x][y] = a;
    flag[a] = false;

    bool f = false;
    for (int i = 1; i <= num; i++) {
        if (flag[i]) {
            f = true;
            break;
        }
    }
    if (!f) {
        printf("YES\n");
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= m; j++) {
                printf("%d", map1[i][j]);
                if (j != m)printf(" ");
            }
            printf("\n");
        }
        exit(0);
    }

    if (map1[x + 1][y] == -1 && x + 1 <= n) {
        for (int i = 1; i <= num; i++) {
            if (flag[i] && check(i, x + 1, y)) {
                dfs(i, x + 1, y);
            }

        }
    }
    if (map1[x - 1][y] == -1 && x - 1 >= 1) {
        for (int i = 1; i <= num; i++) {
            if (flag[i] && check(i, x - 1, y)) {
                dfs(i, x - 1, y);
            }
        }
    }
    if (map1[x][y - 1] == -1 && y - 1 >= 1) {
        for (int i = 1; i <= num; i++) {
            if (flag[i] && check(i, x, y - 1)) {
                dfs(i, x, y - 1);
            }
        }
    }
    if (map1[x][y + 1] == -1 && y + 1 <= m) {
        for (int i = 1; i <= num; i++) {
            if (flag[i] && check(i, x, y + 1)) {
                dfs(i, x, y + 1);
            }
        }
    }

    map1[x][y] = -1;
    flag[a] = true;
}

int main() {

#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
#endif

    scanf("%d%d", &n, &m);
    num = n * m;

    memset(map1, -1, sizeof(map1));
    memset(flag, 0x3f, sizeof(flag));

    dfs(1, 1, 1);

    printf("NO\n");

    return 0;
}


#include<bits/stdc++.h>
using namespace std;

const int maxn = 500010;
int n, m;
int pos[maxn];
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };

bool check(int i, int j)
{
    int x = (i - 1) / m + 1, y = (i - 1) % m + 1, x2 = (j - 1) / m + 1, y2 = (j - 1) % m + 1;
    for (int k = 0; k<4; k++)
        if (x + dx[k] == x2 && y + dy[k] == y2)
            return 1;
    return 0;
}

bool dfs(int i)                 //返回1表示i以及之后的可以实现，0就是不能实现
{
    if (i == n*m + 1)
        return 1;
    int x = (i - 1) / m + 1, y = (i - 1) % m + 1;
    for (int j = i; j <= n*m; j++)
    {
        swap(pos[i], pos[j]);
        if (x != 1 && check(pos[i], pos[(x - 2)*m + y]))//上方是否相邻
            continue;
        if (y != 1 && check(pos[i], pos[(x - 1)*m + y - 1]))//左边是否相邻
            continue;
        if (dfs(i + 1))
            return 1;
        swap(pos[i], pos[j]);
    }
    return 0;
}

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
            pos[(i - 1)*m + j] = (i - 1)*m + j;
    if (!dfs(1))
        return puts("NO"), 0;
    puts("YES");
    for (int i = 1; i <= n; i++, puts(""))
        for (int j = 1; j <= m; j++)
            printf("%d ", pos[(i - 1)*m + j]);
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
#include <vector>
#define lld long long
#define PB push_back
#define F first
#define S second
#define jizz cin.tie(0);ios_base::sync_with_stdio(0);
#define endl '\n'
using namespace std;
typedef pair<int,int> Pair;
int main(){jizz
	int n,m;cin >> n >> m;
	int a[n+5][m+5];
	for(int i = 1; i <= n ; i++){
		for(int j = 1; j <= m ; j++){
			a[i][j] = (i-1)*m+j;
		}
	}
	if(n == 1 || m == 1){
		if(n == 1 && m < 4){
			return cout << "NO",0;
		}else if (m == 1 && n < 4)return cout << "NO",0;
		if(n == 1){
			cout << "YES" << endl;
			for(int j = 1; j <= m/2 ; j++){
				cout << j+m/2 << ' ' << j << ' ' ;
			}
			if(m&1){
				cout << m << ' ';
			}

			return 0;
		}else{
			cout << "YES" << endl;
			for(int i = 1; i <= n/2; i++){
				cout << i+n/2 <<endl << i << endl;
			}
			if(n & 1){
				cout << n << endl;
			}
		}
		return 0;
	}if(n == 3 && m == 3){
		cout << "YES\n1 5 3\n4 8 6\n7 2 9\n";
		return 0;
	}
	else if(n <= 3 && m <= 3){
		cout << "NO" << endl;
	}else{
		for(int i = 1 ; i <= m ; i++){
			if(i & 1){
				int tmp = a[1][i];
				for(int j = 1 ; j < n ; j++){
					a[j][i] = a[j+1][i];
				}
				a[n][i] = tmp;
			}
		}
		for(int i = 1; i <= n ; i++){
			if(i & 1){
				int tmp =a[i][1],tmp2 = a[i][2];
				for(int j = 1; j <= m-2 ;j++){
					a[i][j] = a[i][j+2];
				}
				a[i][m-1] = tmp;
				a[i][m] = tmp2;
			}
		}
		cout << "YES" << endl;
		for(int i= 1 ; i <= n ; i++){
			for(int j = 1; j <= m ;j++){
				cout<<a[i][j] << ' ';
			}cout << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
#include <vector>
#define lld long long
#define PB push_back
#define F first
#define S second
#define jizz cin.tie(0);ios_base::sync_with_stdio(0);
#define endl '\n'
using namespace std;
typedef pair<int,int> Pair;
int main(){jizz
	int n,m;cin >> n >> m;
	int a[n+5][m+5];
	for(int i = 1; i <= n ; i++){
		for(int j = 1; j <= m ; j++){
			a[i][j] = (i-1)*m+j;
		}
	}
	if(n == 1 || m == 1){
		if(n == 1 && m < 4){
			return cout << "NO",0;
		}else if (m == 1 && n < 4)return cout << "NO",0;
		if(n == 1){
			for(int j = 1; j <= m/2 ; j++){
				cout << j+m/2 << ' ' << j << ' ' ;
			}
			if(m&1){
				cout << m << ' ';
				m--;
			}

			return 0;
		}else{
			for(int i = 1; i <= n/2; i++){
				cout << i+n/2 <<endl << i << endl;
			}
			if(n & 1){
				cout << n << endl;
				n--;
			}
		}
		return 0;
	}if(n == 2 && m <= 3){
		cout << "NO" << endl;
	}else if(m == 2 && n <= 3){
		cout << "NO" << endl;
	}else{
		for(int i = 1 ; i <= m ; i++){
			if(i & 1){
				int tmp = a[1][i];
				for(int j = 1 ; j < n ; j++){
					a[j][i] = a[j+1][i];
				}
				a[n][i] = tmp;
			}
		}
		for(int i = 1; i <= n ; i++){
			if(i & 1){
				int tmp =a[i][1],tmp2 = a[i][2];
				for(int j = 1; j <= m-2 ;j++){
					a[i][j] = a[i][j+2];
				}
				a[i][m-1] = tmp;
				a[i][m] = tmp2;
			}
		}
		cout << "YES" << endl;
		for(int i= 1 ; i <= n ; i++){
			for(int j = 1; j <= m ;j++){
				cout<<a[i][j] << ' ';
			}cout << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
#include <vector>
#define lld long long
#define PB push_back
#define F first
#define S second
#define jizz cin.tie(0);ios_base::sync_with_stdio(0);
#define endl '\n'
using namespace std;
typedef pair<int,int> Pair;
int main(){jizz
	int n,m;cin >> n >> m;
	int a[n+5][m+5];
	for(int i = 1; i <= n ; i++){
		for(int j = 1; j <= m ; j++){
			a[i][j] = (i-1)*m+j;
		}
	}
	if(n == 1 || m == 1){
		if(n == 1 && m < 4){
			return cout << "NO",0;
		}else if (m == 1 && n < 4)return cout << "NO",0;
		if(n == 1){
			cout << "YES" << endl;
			for(int j = 1; j <= m/2 ; j++){
				cout << j+m/2 << ' ' << j << ' ' ;
			}
			if(m&1){
				cout << m << ' ';
			}

			return 0;
		}else{
			cout << "YES" << endl;
			for(int i = 1; i <= n/2; i++){
				cout << i+n/2 <<endl << i << endl;
			}
			if(n & 1){
				cout << n << endl;
			}
		}
		return 0;
	}if(n == 3 && m == 3){
		cout << "YES\n1 5 3\n8 6 4\n7 2 9\n";
		return 0;
	}
	else if(n <= 3 && m <= 3){
		cout << "NO" << endl;
	}else{
		for(int i = 1 ; i <= m ; i++){
			if(i & 1){
				int tmp = a[1][i];
				for(int j = 1 ; j < n ; j++){
					a[j][i] = a[j+1][i];
				}
				a[n][i] = tmp;
			}
		}
		for(int i = 1; i <= n ; i++){
			if(i & 1){
				int tmp =a[i][1],tmp2 = a[i][2];
				for(int j = 1; j <= m-2 ;j++){
					a[i][j] = a[i][j+2];
				}
				a[i][m-1] = tmp;
				a[i][m] = tmp2;
			}
		}
		cout << "YES" << endl;
		for(int i= 1 ; i <= n ; i++){
			for(int j = 1; j <= m ;j++){
				cout<<a[i][j] << ' ';
			}cout << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
#include <vector>
#define lld long long
#define PB push_back
#define F first
#define S second
#define jizz cin.tie(0);ios_base::sync_with_stdio(0);
#define endl '\n'
using namespace std;
typedef pair<int,int> Pair;
int main(){jizz
	int n,m;cin >> n >> m;
	int a[n+5][m+5];
	for(int i = 1; i <= n ; i++){
		for(int j = 1; j <= m ; j++){
			a[i][j] = (i-1)*m+j;
		}
	}
	if(n == 1 || m == 1){
		if(n == 1 && m < 4){
			return cout << "NO",0;
		}else if (m == 1 && n < 4)return cout << "NO",0;
		if(n == 1){
			cout << "YES" << endl;
			for(int j = 1; j <= m/2 ; j++){
				cout << j+m/2 << ' ' << j << ' ' ;
			}
			if(m&1){
				cout << m << ' ';
				m--;
			}

			return 0;
		}else{
			cout << "YES" << endl;
			for(int i = 1; i <= n/2; i++){
				cout << i+n/2 <<endl << i << endl;
			}
			if(n & 1){
				cout << n << endl;
				n--;
			}
		}
		return 0;
	}if(n == 2 && m <= 3){
		cout << "NO" << endl;
	}else if(m == 2 && n <= 3){
		cout << "NO" << endl;
	}else{
		for(int i = 1 ; i <= m ; i++){
			if(i & 1){
				int tmp = a[1][i];
				for(int j = 1 ; j < n ; j++){
					a[j][i] = a[j+1][i];
				}
				a[n][i] = tmp;
			}
		}
		for(int i = 1; i <= n ; i++){
			if(i & 1){
				int tmp =a[i][1],tmp2 = a[i][2];
				for(int j = 1; j <= m-2 ;j++){
					a[i][j] = a[i][j+2];
				}
				a[i][m-1] = tmp;
				a[i][m] = tmp2;
			}
		}
		cout << "YES" << endl;
		for(int i= 1 ; i <= n ; i++){
			for(int j = 1; j <= m ;j++){
				cout<<a[i][j] << ' ';
			}cout << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
#include <vector>
#define lld long long
#define PB push_back
#define F first
#define S second
#define jizz cin.tie(0);ios_base::sync_with_stdio(0);
#define endl '\n'
using namespace std;
typedef pair<int,int> Pair;
int main(){jizz
	int n,m;cin >> n >> m;
	int a[n+5][m+5];
	for(int i = 1; i <= n ; i++){
		for(int j = 1; j <= m ; j++){
			a[i][j] = (i-1)*m+j;
		}
	}
	if(n == 1 || m == 1){
		if(n == 1 && m <= 4){
			return cout << "NO",0;
		}else if (m == 1 && n <= 4)return cout << "NO",0;
		if(n == 1){
			if(m&1){
				cout << m << ' ';
				m--;
			}
			for(int j = 1; j <= m/2 ; j++){
				cout << j << ' ' << j+m/2 << ' ' ;
			}
			return 0;
		}else{
			if(n &1){
				cout << n << endl;
				n--;
			}
			for(int i = 1; i <= n/2; i++){
				cout << i <<endl << i+n/2 << endl;
			}
		}
		return 0;
	}if(n == 2 && m <= 3){
		cout << "NO" << endl;
	}else if(m == 2 && n <= 3){
		cout << "NO" << endl;
	}else{
		for(int i = 1 ; i <= m ; i++){
			if(i & 1){
				int tmp = a[1][i];
				for(int j = 1 ; j < n ; j++){
					a[j][i] = a[j+1][i];
				}
				a[n][i] = tmp;
			}
		}
		for(int i = 1; i <= n ; i++){
			if(i & 1){
				int tmp =a[i][1],tmp2 = a[i][2];
				for(int j = 1; j <= m-2 ;j++){
					a[i][j] = a[i][j+2];
				}
				a[i][m-1] = tmp;
				a[i][m] = tmp2;
			}
		}
		cout << "YES" << endl;
		for(int i= 1 ; i <= n ; i++){
			for(int j = 1; j <= m ;j++){
				cout<<a[i][j] << ' ';
			}cout << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
#include <vector>
#define lld long long
#define PB push_back
#define F first
#define S second
#define jizz cin.tie(0);ios_base::sync_with_stdio(0);
#define endl '\n'
using namespace std;
typedef pair<int,int> Pair;
int main(){jizz
	int n,m;cin >> n >> m;
	int a[n+5][m+5];
	for(int i = 1; i <= n ; i++){
		for(int j = 1; j <= m ; j++){
			a[i][j] = (i-1)*m+j;
		}
	}if(n == 1 && m == 1)return cout <<"YES\n1\n",0;
	if(n == 1 || m == 1){
		if(n == 1 && m < 4){
			return cout << "NO",0;
		}else if (m == 1 && n < 4)return cout << "NO",0;
		if(n == 1){
			cout << "YES" << endl;
			for(int j = 1; j <= m/2 ; j++){
				cout << j+m/2 << ' ' << j << ' ' ;
			}
			if(m&1){
				cout << m << ' ';
			}

			return 0;
		}else{
			cout << "YES" << endl;
			for(int i = 1; i <= n/2; i++){
				cout << i+n/2 <<endl << i << endl;
			}
			if(n & 1){
				cout << n << endl;
			}
		}
		return 0;
	}if(n == 3 && m == 3){
		cout << "YES\n1 8 2\n5 3 4\n9 7 6\n";
	}
	else if(n <= 3 && m <= 3){
		cout << "NO" << endl;
	}else{
		if(n == 4 && m == 2){
			return cout << "YES\n2 5\n7 4\n6 1\n3 8\n",0;
		}
		for(int i = 1 ; i <= m ; i++){
			if(i & 1){
				int tmp = a[1][i];
				for(int j = 1 ; j < n ; j++){
					a[j][i] = a[j+1][i];
				}
				a[n][i] = tmp;
			}
		}
		for(int i = 1; i <= n ; i++){
			if(i & 1){
				int tmp =a[i][1],tmp2 = a[i][2];
				for(int j = 1; j <= m-2 ;j++){
					a[i][j] = a[i][j+2];
				}
				a[i][m-1] = tmp;
				a[i][m] = tmp2;
			}
		}
		cout << "YES" << endl;
		for(int i= 1 ; i <= n ; i++){
			for(int j = 1; j <= m ;j++){
				cout<<a[i][j] << ' ';
			}cout << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
#include <vector>
#define lld long long
#define PB push_back
#define F first
#define S second
#define jizz cin.tie(0);ios_base::sync_with_stdio(0);
#define endl '\n'
using namespace std;
typedef pair<int,int> Pair;
int main(){jizz
	int n,m;cin >> n >> m;
	if(n == 1 && m == 1)return cout <<"YES\n1\n",0;
	if(n == 1 || m == 1){
		if(n == 1 && m < 4){
			return cout << "NO",0;
		}else if (m == 1 && n < 4)return cout << "NO",0;
		if(n == 1){
			cout << "YES" << endl;
			for(int j = 1; j <= m/2 ; j++){
				cout << j+m/2 << ' ' << j << ' ' ;
			}
			if(m&1){
				cout << m << ' ';
			}

			return 0;
		}else{
			cout << "YES" << endl;
			for(int i = 1; i <= n/2; i++){
				cout << i+n/2 <<endl << i << endl;
			}
			if(n & 1){
				cout << n << endl;
			}
		}
		return 0;
	}if(n == 3 && m == 3){
		cout << "YES\n1 8 2\n5 3 4\n9 7 6\n";
	}
	else if(n <= 3 && m <= 3){
		cout << "NO" << endl;
	}else{
		bool flag = 0;
		if(n > m )swap(n,m),flag = 1;
	int a[n+5][m+5];
	for(int i = 1; i <= n ; i++){
		for(int j = 1; j <= m ; j++){
			a[i][j] = (i-1)*m+j;
		}
	}

		for(int i = 1 ; i <= m ; i++){
			if(i & 1){
				int tmp = a[1][i];
				for(int j = 1 ; j < n ; j++){
					a[j][i] = a[j+1][i];
				}
				a[n][i] = tmp;
			}
		}
		for(int i = 1; i <= n ; i++){
			if(i & 1){
				int tmp =a[i][1],tmp2 = a[i][2];
				for(int j = 1; j <= m-2 ;j++){
					a[i][j] = a[i][j+2];
				}
				a[i][m-1] = tmp;
				a[i][m] = tmp2;
			}
		}
		if(!flag){
			cout << "YES" << endl;
			for(int i= 1 ; i <= n ; i++){
				for(int j = 1; j <= m ;j++){
					cout<<a[i][j] << ' ';
				}cout << endl;
			}
		}else{
			for(int i = 1; i <= m ; i++){
				for(int j = 1; j <= n ; j++){
					cout << a[j][i] << ' ';
				}cout << endl;
			}

		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
#include <vector>
#define lld long long
#define PB push_back
#define F first
#define S second
#define jizz cin.tie(0);ios_base::sync_with_stdio(0);
#define endl '\n'
using namespace std;
typedef pair<int,int> Pair;
int main(){jizz
	int n,m;cin >> n >> m;
	int a[n+5][m+5];
	for(int i = 1; i <= n ; i++){
		for(int j = 1; j <= m ; j++){
			a[i][j] = (i-1)*m+j;
		}

	}if(n == 1 && m == 1)return cout <<"YES\n1\n",0;
	if(n == 1 || m == 1){
		if(n == 1 && m < 4){
			return cout << "NO",0;
		}else if (m == 1 && n < 4)return cout << "NO",0;
		if(n == 1){
			cout << "YES" << endl;
			for(int j = 1; j <= m/2 ; j++){
				cout << j+m/2 << ' ' << j << ' ' ;
			}
			if(m&1){
				cout << m << ' ';
			}

			return 0;
		}else{
			cout << "YES" << endl;
			for(int i = 1; i <= n/2; i++){
				cout << i+n/2 <<endl << i << endl;
			}
			if(n & 1){
				cout << n << endl;
			}
		}
		return 0;
	}if(n == 3 && m == 3){
		cout << "YES\n1 8 2\n5 3 4\n9 7 6\n";
	}
	else if(n <= 3 && m <= 3){
		cout << "NO" << endl;
	}else{
		for(int i = 1 ; i <= m ; i++){
			if(i & 1){
				int tmp = a[1][i];
				for(int j = 1 ; j < n ; j++){
					a[j][i] = a[j+1][i];
				}
				a[n][i] = tmp;
			}
		}
		for(int i = 1; i <= n ; i++){
			if(i & 1){
				int tmp =a[i][1],tmp2 = a[i][2];
				for(int j = 1; j <= m-2 ;j++){
					a[i][j] = a[i][j+2];
				}
				a[i][m-1] = tmp;
				a[i][m] = tmp2;
			}
		}
		cout << "YES" << endl;
		for(int i= 1 ; i <= n ; i++){
			for(int j = 1; j <= m ;j++){
				cout<<a[i][j] << ' ';
			}cout << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
#include <vector>
#define lld long long
#define PB push_back
#define F first
#define S second
#define jizz cin.tie(0);ios_base::sync_with_stdio(0);
#define endl '\n'
using namespace std;
typedef pair<int,int> Pair;
int main(){jizz
	int n,m;cin >> n >> m;
	int a[n+5][m+5];
	for(int i = 1; i <= n ; i++){
		for(int j = 1; j <= m ; j++){
			a[i][j] = (i-1)*m+j;
		}
	}
	if(n == 1 || m == 1){
		if(n == 1 && m < 4){
			return cout << "NO",0;
		}else if (m == 1 && n < 4)return cout << "NO",0;
		if(n == 1){
			cout << "YES" << endl;
			for(int j = 1; j <= m/2 ; j++){
				cout << j+m/2 << ' ' << j << ' ' ;
			}
			if(m&1){
				cout << m << ' ';
				m--;
			}

			return 0;
		}else{
			cout << "YES" << endl;
			for(int i = 1; i <= n/2; i++){
				cout << i+n/2 <<endl << i << endl;
			}
			if(n & 1){
				cout << n << endl;
				n--;
			}
		}
		return 0;
	}if(n <= 3 && m <= 3){
		cout << "NO" << endl;
	}else if(m <= 3 && n <= 3){
		cout << "NO" << endl;
	}else{
		for(int i = 1 ; i <= m ; i++){
			if(i & 1){
				int tmp = a[1][i];
				for(int j = 1 ; j < n ; j++){
					a[j][i] = a[j+1][i];
				}
				a[n][i] = tmp;
			}
		}
		for(int i = 1; i <= n ; i++){
			if(i & 1){
				int tmp =a[i][1],tmp2 = a[i][2];
				for(int j = 1; j <= m-2 ;j++){
					a[i][j] = a[i][j+2];
				}
				a[i][m-1] = tmp;
				a[i][m] = tmp2;
			}
		}
		cout << "YES" << endl;
		for(int i= 1 ; i <= n ; i++){
			for(int j = 1; j <= m ;j++){
				cout<<a[i][j] << ' ';
			}cout << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <queue>
#include <vector>
#define lld long long
#define PB push_back
#define F first
#define S second
#define jizz cin.tie(0);ios_base::sync_with_stdio(0);
#define endl '\n'
using namespace std;
typedef pair<int,int> Pair;
int main(){jizz
	int n,m;cin >> n >> m;
	if(n == 1 && m == 1)return cout <<"YES\n1\n",0;
	if(n == 1 || m == 1){
		if(n == 1 && m < 4){
			return cout << "NO",0;
		}else if (m == 1 && n < 4)return cout << "NO",0;
		if(n == 1){
			cout << "YES" << endl;
			for(int j = 1; j <= m/2 ; j++){
				cout << j+m/2 << ' ' << j << ' ' ;
			}
			if(m&1){
				cout << m << ' ';
			}
			return 0;
		}else{
			cout << "YES" << endl;
			for(int i = 1; i <= n/2; i++){
				cout << i+n/2 <<endl << i << endl;
			}
			if(n & 1){
				cout << n << endl;
			}
		}
		return 0;
	}if(n == 3 && m == 3){
		cout << "YES\n1 8 2\n5 3 4\n9 7 6\n";
	}
	else if(n <= 3 && m <= 3){
		cout << "NO" << endl;
	}else{
		bool flag = 0;
		if(n > m)swap(n,m),flag = 1;
		int a[n+5][m+5];
		for(int i = 1; i <= n ; i++){
			for(int j = 1; j <= m ; j++){
				if(!flag)a[i][j] = (i-1)*m+j;
				else a[i][j] = (j-1)*n+i;
			}
		}
		for(int i = 1 ; i <= m ; i++){
			if(i & 1){
				int tmp = a[1][i];
				for(int j = 1 ; j < n ; j++){
					a[j][i] = a[j+1][i];
				}
				a[n][i] = tmp;
			}
		}
		for(int i = 1; i <= n ; i++){
			if(i & 1){
				int tmp =a[i][1],tmp2 = a[i][2];
				for(int j = 1; j <= m-2 ;j++){
					a[i][j] = a[i][j+2];
				}
				a[i][m-1] = tmp;
				a[i][m] = tmp2;
			}
		}cout <<"YES\n";
		if(!flag){
		for(int i= 1 ; i <= n ; i++){
			for(int j = 1; j <= m ;j++){
				cout<<a[i][j] << ' ';
			}cout << endl;
		}}else{
			for(int i = 1; i <= m ; i++){
				for(int j = 1; j <= n ; j++){
					cout << a[j][i] << ' ';
				}cout <<endl;
			}

		}
	}
	return 0;
}


/**************************************************************
    Problem: ????
    User: (ina)xiaodongc
    Language: C++
    Result: Accepted
    Time:0 ms
    Memory:0 kb
    length:0 kb
    score: inf
****************************************************************/
/*
A possible implementation
The first few steps are just BST routine
Node deletion algorithm
Specifically, we're going to have a search
And assume that the target node does exist
So we call the removeAt routine
Remove the node physically
Next, we're still going through a for cycle
Ancestral ancestors traversing deleted nodes
Please pay special attention to our starting point
The father of the deleted node
Instead of inserting it like that
It can start directly from its grandfather
Then, in the course of the whole traversal
Each of us discovers an unbalanced ancestor G
Make a proper rotation adjustment to the ancestor
The three nodes involved in rotation are still G
And the taller kid, P
And the higher grandson V down there
And whether it's unbalanced or rotated
We all need to update the height of this ancestor
You can see that in the worst case
Really need to do logn times
You might as well take the control logic of the previous insert operation
Make a contrast here
No, there's nothing
Tricks to terminate the traversal process ahead of time
Because in the worst case
We really need to leave everything behind
Deal with all generations of ancestors
Since then, we can successfully end the algorithm
And return
So far you may find out
Here's the rotation
We haven't given a specific implementation of it
It's exactly what we suggested
Single spin and double spin in that way?
Interestingly enough, the answer is negative
*/
using namespace std;
#include<deque>
#include<stdint.h>
#include<set>
#include<stack>
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
#include<map>
#define sqr(x) (x)*(x)
#define sort stable_sort
#define ll long long
#define mp make_pair
#define pb push_back
#define in insert
#define mtr(x,y,z) mp(mp(x,y),z)
#define fi first
#define se second
#define lch(x) ((x)<<1)
#define rch(x) (((x)<<1)|1)
#define all(x) (x).begin(),(x).end()
#define fpi(x) freopen(x,"r",stdin);
#define fpo(x) freopen(x,"w",stdout);
#define fprio fpi("in.txt");fpo("out.txt"):
#define fast ios::sync_with_stdio(false);
void readi(int &x)
{
	int v=0,f=1;
	char c=getchar();
	while (!isdigit(c)&&c!='-') c=getchar();
	if (c=='-') f=-1; else v=v*10+c-'0';
	while (isdigit(c=getchar())) v=v*10+c-'0';
	x=v*f;
}
void readll(ll &x)
{
	ll v=0ll,f=1ll;
	char c=getchar();
	while (!isdigit(c)&&c!='-') c=getchar();
	if (c=='-') f=-1; else v=v*10+c-'0';
	while (isdigit(c=getchar())) v=v*10+c-'0';
	x=v*f;
}
void readc(char &x)
{
	char c;
	while ((c=getchar())==' ');
	x=c;
}
void writes(string s){puts(s.c_str());}
void writeln(){writes("");}
void writei(int x)
{
	if (!x) putchar('0');
	char a[25];
	int top=0;
	while (x)
	{
		a[++top]=(x%10)+'0';
		x/=10;
	}
	while (top)
	{
		putchar(a[top]);
		top--;
	}
}
void writell(ll x)
{
	if (!x) putchar('0');
	char a[25];
	int top=0;
	while (x)
	{
		a[++top]=(x%10)+'0';
		x/=10;
	}
	while (top)
	{
		putchar(a[top]);
		top--;
	}
}
ll qp(ll x,ll y)
{
	if (y==0) return 1;
	if (y==1) return x;
	ll z=qp(x,y/2);
	z=z*z%1000000007;
	if (y&1) z=z*x%1000000007;
	return z;
}
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define si set<int>
#define sl set<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define msi map<string,int>
#define msl map<string,ll>
#define piii pair<int,pii>
#define piipi pair<pii,int>
#define plll pair<ll,pll>
#define pllpl pair<pll,ll>
#define pqi priority_queue<int>
#define pql priority_queue<ll>
#define npqi priority_queue<int,vector<int>,greater<int> >
#define npql priority_queue<ll,vector<ll>,greater<ll> >
/*************************************************/
int n,m,i,j,a[100005],b[5][5],c[100005];
vector<vector<int> > ans;
int main()
{
	cin>>n>>m;
	if (n<=3&&m<=3)
	{
		for (i=1;i<=m*n;i++) a[i]=i;
		do
		{
			int cnt=0;
			for (i=1;i<=n;i++)
			{
				for (j=1;j<=m;j++)
				{
					b[i][j]=a[++cnt];
				}
			}
			bool ok=1;
			for (i=1;i<=n&&ok;i++)
			{
				for (j=1;j<=m;j++)
				{
					if (b[i][j+1]==b[i][j]+1) {ok=0;break;}
					if (b[i][j+1]==b[i][j]-1) {ok=0;break;}
					if (b[i][j+1]==b[i][j]+m) {ok=0;break;}
					if (b[i][j+1]==b[i][j]-m) {ok=0;break;}
					if (b[i][j-1]==b[i][j]+1) {ok=0;break;}
					if (b[i][j-1]==b[i][j]-1) {ok=0;break;}
					if (b[i][j-1]==b[i][j]+m) {ok=0;break;}
					if (b[i][j-1]==b[i][j]-m) {ok=0;break;}
					if (b[i+1][j]==b[i][j]+1) {ok=0;break;}
					if (b[i+1][j]==b[i][j]-1) {ok=0;break;}
					if (b[i+1][j]==b[i][j]+m) {ok=0;break;}
					if (b[i+1][j]==b[i][j]-m) {ok=0;break;}
					if (b[i-1][j]==b[i][j]+1) {ok=0;break;}
					if (b[i-1][j]==b[i][j]-1) {ok=0;break;}
					if (b[i-1][j]==b[i][j]+m) {ok=0;break;}
					if (b[i-1][j]==b[i][j]-m) {ok=0;break;}
				}
			}
			if (ok)
			{
				cout<<"YES\n";
				for (i=1;i<=n;i++)
				{
					for (j=1;j<=m;j++)
					{
						cout<<b[i][j]<<' ';
					}
					cout<<endl;
				}
				return 0;
			}
		}while (next_permutation(a+1,a+n*m+1));
		cout<<"NO\n";
		return 0;
	}
	cout<<"YES\n";
	if (m>3)
	{
		int cnt=0;
		for (i=1;i<=(m+1)/2;i++)
		{
			a[++cnt]=i;
			a[++cnt]=i+(m+1)/2;
		}
		//for (i=1;i<=m;i++) cout<<a[i]<<' ';
		if (m%2==0) {for (i=1;i<=n;i++)
		{
			reverse(a+1,a+m+1);
			for (j=1;j<=m;j++)
			{
				cout<<(i-1)*m+a[j]<<' ';
			}
			cout<<endl;
		}
		return 0;}
		else{
			int cnt=0;
			for (i=1;i<=m/2;i++)
			{
				c[++cnt]=i+(m+1)/2-1;
				c[++cnt]=i;
			}
			c[++cnt]=m;
			for (i=1;i<=n;i++)
			{
				//reverse(c+1,c+m+1);
				for (j=1;j<=m;j++)
				{
					if (i&1) cout<<(i-1)*m+c[j]<<' '; else cout<<(i-1)*m+a[j]<<' ';
				}
				cout<<endl;
			}
			return 0;
		}
	}
	else
	{
		swap(n,m);
		int cnt=0;
		for (i=1;i<=(m+1)/2;i++)
		{
			a[++cnt]=i;
			a[++cnt]=i+(m+1)/2;
		}
		//for (i=1;i<=m;i++) cout<<a[i]<<' ';
		if (m%2==0) {for (i=1;i<=n;i++)
		{
			reverse(a+1,a+m+1);vi e;
			ans.push_back(e);
			for (j=1;j<=m;j++)
			{
				ans.back().push_back((i-1)*m+a[j]);
			}
		}
		}
		else{
			int cnt=0;
			for (i=1;i<=m/2;i++)
			{
				c[++cnt]=i+(m+1)/2-1;
				c[++cnt]=i;
			}
			c[++cnt]=m;
			for (i=1;i<=n;i++)
			{
				//reverse(c+1,c+m+1);
				vi e;
			ans.push_back(e);
			for (j=1;j<=m;j++)
			{
				if (i&1) ans.back().pb((i-1)*m+c[j]); else ans.back().pb((i-1)*m+a[j]);
			}
			}
		}
		swap(n,m);
		for (i=0;i<n;i++)
		{
			for (j=0;j<m;j++)
			{
				cout<<ans[j][i]<<' ';
			}
			cout<<endl;
		}
	}
	return 0;
}


/**************************************************************
    Problem: ????
    User: (ina)xiaodongc
    Language: C++
    Result: Accepted
    Time:0 ms
    Memory:0 kb
    length:0 kb
    score: inf
****************************************************************/
/*
A possible implementation
The first few steps are just BST routine
Node deletion algorithm
Specifically, we're going to have a search
And assume that the target node does exist
So we call the removeAt routine
Remove the node physically
Next, we're still going through a for cycle
Ancestral ancestors traversing deleted nodes
Please pay special attention to our starting point
The father of the deleted node
Instead of inserting it like that
It can start directly from its grandfather
Then, in the course of the whole traversal
Each of us discovers an unbalanced ancestor G
Make a proper rotation adjustment to the ancestor
The three nodes involved in rotation are still G
And the taller kid, P
And the higher grandson V down there
And whether it's unbalanced or rotated
We all need to update the height of this ancestor
You can see that in the worst case
Really need to do logn times
You might as well take the control logic of the previous insert operation
Make a contrast here
No, there's nothing
Tricks to terminate the traversal process ahead of time
Because in the worst case
We really need to leave everything behind
Deal with all generations of ancestors
Since then, we can successfully end the algorithm
And return
So far you may find out
Here's the rotation
We haven't given a specific implementation of it
It's exactly what we suggested
Single spin and double spin in that way?
Interestingly enough, the answer is negative
*/
using namespace std;
#include<deque>
#include<stdint.h>
#include<set>
#include<stack>
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cstring>
#include<map>
#define sqr(x) (x)*(x)
#define sort stable_sort
#define ll long long
#define mp make_pair
#define pb push_back
#define in insert
#define mtr(x,y,z) mp(mp(x,y),z)
#define fi first
#define se second
#define lch(x) ((x)<<1)
#define rch(x) (((x)<<1)|1)
#define all(x) (x).begin(),(x).end()
#define fpi(x) freopen(x,"r",stdin);
#define fpo(x) freopen(x,"w",stdout);
#define fprio fpi("in.txt");fpo("out.txt"):
#define fast ios::sync_with_stdio(false);
void readi(int &x)
{
	int v=0,f=1;
	char c=getchar();
	while (!isdigit(c)&&c!='-') c=getchar();
	if (c=='-') f=-1; else v=v*10+c-'0';
	while (isdigit(c=getchar())) v=v*10+c-'0';
	x=v*f;
}
void readll(ll &x)
{
	ll v=0ll,f=1ll;
	char c=getchar();
	while (!isdigit(c)&&c!='-') c=getchar();
	if (c=='-') f=-1; else v=v*10+c-'0';
	while (isdigit(c=getchar())) v=v*10+c-'0';
	x=v*f;
}
void readc(char &x)
{
	char c;
	while ((c=getchar())==' ');
	x=c;
}
void writes(string s){puts(s.c_str());}
void writeln(){writes("");}
void writei(int x)
{
	if (!x) putchar('0');
	char a[25];
	int top=0;
	while (x)
	{
		a[++top]=(x%10)+'0';
		x/=10;
	}
	while (top)
	{
		putchar(a[top]);
		top--;
	}
}
void writell(ll x)
{
	if (!x) putchar('0');
	char a[25];
	int top=0;
	while (x)
	{
		a[++top]=(x%10)+'0';
		x/=10;
	}
	while (top)
	{
		putchar(a[top]);
		top--;
	}
}
ll qp(ll x,ll y)
{
	if (y==0) return 1;
	if (y==1) return x;
	ll z=qp(x,y/2);
	z=z*z%1000000007;
	if (y&1) z=z*x%1000000007;
	return z;
}
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define si set<int>
#define sl set<ll>
#define mii map<int,int>
#define mll map<ll,ll>
#define msi map<string,int>
#define msl map<string,ll>
#define piii pair<int,pii>
#define piipi pair<pii,int>
#define plll pair<ll,pll>
#define pllpl pair<pll,ll>
#define pqi priority_queue<int>
#define pql priority_queue<ll>
#define npqi priority_queue<int,vector<int>,greater<int> >
#define npql priority_queue<ll,vector<ll>,greater<ll> >
/*************************************************/
int n,m,i,j,a[100005],b[5][5],c[100005];
vector<vector<int> > ans;
int main()
{
	cin>>n>>m;
	if (m==4)
	{
		if (n==1) {cout<<"YES\n2 4 1 3";return 0;}
		if (n==2) {cout<<"YES\n5 4 7 2\n3 6 1 8";return 0;}
		if (n==3) {cout<<"YES\n1 7 5 9\n10 2 12 3\n4 8 6 11";return 0;}
		if (n==4) {cout<<"YES\n1 4 11 8\n10 7 2 5\n3 16 9 14\n6 13 15 12";return 0;}
	}
	if (n==4)
	{
		if (m==1) {cout<<"YES\n2\n1\n4\n3\n";return 0;}
		if (m==2) {cout<<"YES\n5 3\n4 6\n7 1\n2 8";return 0;}
		if (m==3) {cout<<"YES\n1 10 4\n7 2 8\n5 12 6\n9 3 11";return 0;}
	}
	if (n<=3&&m<=3)
	{
		for (i=1;i<=m*n;i++) a[i]=i;
		do
		{
			int cnt=0;
			for (i=1;i<=n;i++)
			{
				for (j=1;j<=m;j++)
				{
					b[i][j]=a[++cnt];
				}
			}
			bool ok=1;
			for (i=1;i<=n&&ok;i++)
			{
				for (j=1;j<=m;j++)
				{
					if (b[i][j+1]&&b[i][j+1]==b[i][j]+1) {ok=0;break;}
					if (b[i][j+1]&&b[i][j+1]==b[i][j]-1) {ok=0;break;}
					if (b[i][j+1]&&b[i][j+1]==b[i][j]+m) {ok=0;break;}
					if (b[i][j+1]&&b[i][j+1]==b[i][j]-m) {ok=0;break;}
					if (b[i][j-1]&&b[i][j-1]==b[i][j]+1) {ok=0;break;}
					if (b[i][j-1]&&b[i][j-1]==b[i][j]-1) {ok=0;break;}
					if (b[i][j-1]&&b[i][j-1]==b[i][j]+m) {ok=0;break;}
					if (b[i][j-1]&&b[i][j-1]==b[i][j]-m) {ok=0;break;}
					if (b[i+1][j]&&b[i+1][j]==b[i][j]+1) {ok=0;break;}
					if (b[i+1][j]&&b[i+1][j]==b[i][j]-1) {ok=0;break;}
					if (b[i+1][j]&&b[i+1][j]==b[i][j]+m) {ok=0;break;}
					if (b[i+1][j]&&b[i+1][j]==b[i][j]-m) {ok=0;break;}
					if (b[i-1][j]&&b[i-1][j]==b[i][j]+1) {ok=0;break;}
					if (b[i-1][j]&&b[i-1][j]==b[i][j]-1) {ok=0;break;}
					if (b[i-1][j]&&b[i-1][j]==b[i][j]+m) {ok=0;break;}
					if (b[i-1][j]&&b[i-1][j]==b[i][j]-m) {ok=0;break;}
				}
			}
			if (ok)
			{
				cout<<"YES\n";
				for (i=1;i<=n;i++)
				{
					for (j=1;j<=m;j++)
					{
						cout<<b[i][j]<<' ';
					}
					cout<<endl;
				}
				return 0;
			}
		}while (next_permutation(a+1,a+n*m+1));
		cout<<"NO\n";
		return 0;
	}
	cout<<"YES\n";
	if (m>4)
	{
		int cnt=0;
		for (i=1;i<=(m+1)/2;i++)
		{
			a[++cnt]=i;
			a[++cnt]=i+(m+1)/2;
		}
		//for (i=1;i<=m;i++) cout<<a[i]<<' ';
		if (m%2==0) {for (i=1;i<=n;i++)
		{
			reverse(a+1,a+m+1);
			for (j=1;j<=m;j++)
			{
				cout<<(i-1)*m+a[j]<<' ';
			}
			cout<<endl;
		}
		return 0;}
		else{
			int cnt=0;
			for (i=1;i<=m/2;i++)
			{
				c[++cnt]=i+(m+1)/2-1;
				c[++cnt]=i;
			}
			c[++cnt]=m;
			for (i=1;i<=n;i++)
			{
				//reverse(c+1,c+m+1);
				for (j=1;j<=m;j++)
				{
					if (i&1) cout<<(i-1)*m+c[j]<<' '; else cout<<(i-1)*m+a[j]<<' ';
				}
				cout<<endl;
			}
			return 0;
		}
	}
	else
	{
		swap(n,m);
		int cnt=0;
		for (i=1;i<=(m+1)/2;i++)
		{
			a[++cnt]=i;
			a[++cnt]=i+(m+1)/2;
		}
		//for (i=1;i<=m;i++) cout<<a[i]<<' ';
		if (m%2==0) {for (i=1;i<=n;i++)
		{
			reverse(a+1,a+m+1);vi e;
			ans.push_back(e);
			for (j=1;j<=m;j++)
			{
				ans.back().push_back((i-1)*m+a[j]);
			}
		}
		}
		else{
			int cnt=0;
			for (i=1;i<=m/2;i++)
			{
				c[++cnt]=i+(m+1)/2-1;
				c[++cnt]=i;
			}
			c[++cnt]=m;
			for (i=1;i<=n;i++)
			{
				//reverse(c+1,c+m+1);
				vi e;
			ans.push_back(e);
			for (j=1;j<=m;j++)
			{
				if (i&1) ans.back().pb((i-1)*m+c[j]); else ans.back().pb((i-1)*m+a[j]);
			}
			}
		}
		swap(n,m);
		for (i=0;i<n;i++)
		{
			for (j=0;j<m;j++)
			{
				cout<<ans[j][i]<<' ';
			}
			cout<<endl;
		}
	}
	return 0;
}