#include <bits/stdc++.h>
using namespace std;
int num[10];
int main(){
int a, b, c, d, e, f;
int round = 0;
printf("please input 6 numbers ranging from 4-6 and begin the game:\n");
while(~scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f)){
int zero = 0;
int one = 0;
int above = 0;
bool flag = false;
num[1] = a, num[2] = b, num[3] = c, num[4] = d, num[5] = e, num[6] =f;
for(int i=1; i<=6; i++){
if(num[i] == 0) zero++;
if(num[i] == 1) one++;
else above++;
}
if(zero== 4){
if(one == 1){
for(int i=1; i<=6; i++){
if(num[i]>1){
printf("%d ", 0);
}
else printf("%d ", num[i]);
}
printf("\n");
flag = true;
}
if(one == 2){
printf("Congratulations!YOU WIN!!\n");
break;
}
if(flag == true){
printf("game over!You lose!\n");
break;
}
}
else if(zero== 5){
{
for(int i=1; i<=6; i++){
if(num[i]>1){
printf("%d ", 1);
}
else printf("%d ", 0);
}
printf("\n");
flag = true;
}
if(one == 1){
printf("Congratulations!YOU WIN!!\n");
break;
}
if(flag == true){
printf("game over!You lose!\n");
break;
}
}
if((a^b^c^d^e^f) == 0) printf("GG\n");
for(int a1=1; a1<=a; a1++){
if((((a-a1)^b^c^d^e^f) == 0)){
printf("%d %d %d %d %d %d\n", a-a1, b, c, d, e, f);
flag = true;
printf("--------------------\n");
printf("Now it's your turn\n");
break;
}
}
if(flag == true) continue;
for(int b1=1; b1<=b; b1++){
if((((a)^(b-b1)^c^d^e^f) == 0)){
printf("%d %d %d %d %d %d\n", a, b-b1, c, d, e, f);
flag = true;
printf("--------------------\n");
printf("Now it's your turn\n");
break;
}
}
if(flag == true) continue;
for(int c1=1; c1<=c; c1++){
if((((a)^b^(c-c1)^d^e^f) == 0)){
printf("%d %d %d %d %d %d\n", a, b, c-c1, d, e, f);
flag = true;
printf("--------------------\n");
printf("Now it's your turn\n");
break;
}
}
if(flag == true) continue;
for(int d1=1; d1<=d; d1++){
if((((a)^b^c^(d-d1)^e^f) == 0)){
printf("%d %d %d %d %d %d\n", a, b, c, d-d1, e, f);
flag = true;
printf("--------------------\n");
printf("Now it's your turn\n");
break;
}
}
if(flag == true) continue;
for(int e1=1; e1<=e; e1++){
if((((a)^b^c^d^(e-e1)^f) == 0)){
printf("%d %d %d %d %d %d\n", a, b, c, d, e-e1, f);
flag = true;
printf("--------------------\n");
printf("Now it's your turn\n");
break;
}
}
if(flag == true) continue;
for(int f1=1; f1<=f; f1++){
if(((a)^b^c^d^e^(f-f1)) == 0){
printf("%d %d %d %d %d %d\n", a, b, c, d, e, f-f1);
flag = true;
printf("--------------------\n");
printf("Now it's your turn\n");
break;
}
}
if(flag == true) continue;
}
}