#include"stdio.h"
int main()
{
int i;
int ge,shi,bai,qian;
for(i=1000;i<10000;i++)
{
ge=i%10;
shi=i/10%10;
bai=i/100%10;
qian=i/1000%10;
if((ge==shi||ge==bai||ge==qian)&&(shi!=bai)&&(bai!=qian)&&(shi!=qian))
printf("%d ",i);
if((shi==ge||shi==bai||shi==qian)&&(ge!=bai!=qian)&&(ge!=bai)&&(bai!=qian)&&(ge!=qian))
printf("%d ",i);
if((bai==ge||bai==shi||bai==qian)&&(ge!=shi)&&(shi!=qian)&&(ge!=qian))
printf("%d ",i);
if((qian==ge||qian==shi||qian==bai)&&(ge!=shi)&&(shi!=bai)&&(ge!=bai))
printf("%d ",i);
}
return 0;
}