import java.util.Scanner;
public class EvenParity {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int input[] = new int[8];
for (int i = 0; i < 8; i++) {
input[i] = scanner.nextInt();
}
int cnt=0;
int cols[] = new int[8];
for (int i = 0; i < 8; i++) {
cnt=0;
if (input[i]==0) {
cnt++;
}
if (cnt%2==0) {
cols[i]=0;
}
else {
cols[i]=1;
}
}
for (int i = 0; i < 8; i++) {
System.out.print(" "+input[i]);
}
if (cnt%2==0) {
System.out.print(" "+0);
} else {
System.out.print(" "+1);
}
}
}