struct tree{
int mbit,cmask,cbits;
tree *z0,*z1;
void find(int targ,int dist,ResAcc &res){
if(dist<0) return;
int d=hamdist(targ&cmask,cbits&cmask);
if(d>dist) return;
if(cmask==-1){ res.Add(cbits); return; }
int h=(targ&mbit) ? 1 : 0;
z0->find(targ&~mbit,dist-h,res);
z1->find(targ|mbit,dist-1+h,res);
}
}