50pts WA
#include<iostream>
#define ff(i,k) for(int i=1;i<=k;i++)
#define f(i1,i2) for(int i2=1;i2<=k;i2++)
using namespace std;
int n,k;
int main(){
cin>>n>>k;
if(n==1){
ff(i,k)cout<<i<<endl;
}
if(n==2){
ff(i,k){
f(i,i1) cout<<i<<' '<<i1<<endl;
}
}
if(n==3){
ff(i,k){
f(i,i1){
f(i1,i2) cout<<i<<' '<<i1<<' '<<i2<<endl;
}
}
}
if(n==4){
ff(i,k){
f(i,i1){
f(i1,i2){
f(i2,i3) cout<<i<<' '<<i1<<' '<<i2<<' '<<i3<<endl;
}
}
}
}
if(n==5){
ff(i,k){
f(i,i1){
f(i1,i2){
f(i2,i3){
f(i3,i4) cout<<i<<' '<<i2<<' '<<i3<<' '<<i4<<endl;
}
}
}
}
}
return 0;
}