int main(){
    int A,B,C,D,E,i,j; //?????
    for(A=1;A<=5;A++)//??????
    {for(B=1;B<=5;B++)
    {for(C=1;C<=5;C++)
    {for(D=1;D<=5;D++)
    {for(E=1;E<=5;E++)
    {
        

          if(((E==1)+(B==2)+(A==5)+(C!=1)+(D==1)==2)&&(A!=B&&A!=C&&A!=D&&A!=E&&B!=C&&B!=D&&B!=E&&C!=D&&C!=E&&D!=E)&&(E!=2&&E!=3)&&(((A==1||A==2)&&E==1)+((B==1||B==2)&&B==2)+((C==1||C==2)&&A==5)+((D==1||D==2)&&C!=1)+(E==1&&D==1)==2)) cout<<A<<" "<<B<<" "<<C<<" "<<D<<" "<<E; //??????????????





        }
        }
        }

        }
        }



    return 0;
    }
