#include <iostream>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
int x = 1;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m-1; j++) {
cout << x++ << ' ';
if (j == m - 2){
cout << "PUM" << endl;
x++;
}
}
}
return 0;
}