#include <iostream>
using namespace std;
void func(int* p, int n);
int main() {
int arr[6] = { 0 };
for (int i = 0; i < 6; i++) {
cin >> arr[i];
}
func(arr, 6);
for (int i = 0; i < 6; i++) {
if (i == 5) {
cout << arr[i] << endl;
}
else {
cout << arr[i] << " ";
}
}
return 0;
}
void func(int* p, int n) {
// write your code here......
int left = 0;
int right = n - 1;
while (left <= right - 1) {
if (p[left] == 0) {
int temp = p[left];
for (int i = 0; i < right - left; i ++) {
p[left + i] = p[left + i + 1];
}
p[right] = temp;
right --;
}
left ++;
}
}