#include<cstdio>
#include<algorithm>
using namespace std;
int tot=0;
int n,b,d;
int s[1<<10];
int dist(int t){
int d=0;
while(t){
if (t&1) d++;
t>>=1;
}
return d;
}
bool check(int x){
for (int i=1;i<=tot;i++){
if (dist(x^s[i])<d) return 0;
}
return 1;
}
void solve(){
s[++tot]=0;
for (int i=1;i<=1<<b;i++){
if (check(i)) s[++tot]=i;
if (tot==n) break;
}
}
void work(){
scanf("%d%d%d",&n,&b,&d);
solve();
for (int i=1;i<=tot;i++){
printf("%d ",s[i]);
if (!(i%10)) printf("\n");
}
}
int main(){
freopen("hamming.in","r",stdin);
freopen("hamming.out","w",stdout);
work();
}