#include <iostream>
using namespace std;
int main()
{
int n, m, i, j, a[30][30];
cout << "n="; cin >> n;
cout << "m="; cin >> m;
for (i=1; i<=n; i++)
for (j=1; j<=m; j++)
if (i > j)
a[i][j] = j;
else
a[i][j] = i;
for (i=1; i<=n; i++){
for (j=1; j<=n; j++)
cout << a[i][j] << " ";
cout << endl;
}
return 0;
}