#include<iostream>
using namespace std;
int main(){
int x,y,ans;
const string P="PUM";
cin>>x>>y;
for(int i=1;i<=x;i++) {
for(int j=1;j<y;j++){
ans++;
cout<<ans<<" ";
}
cout<<P<<endl;
ans++;
}
}