#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
 
int main() {
	vector <int> a, b;
	int element;
	while (cin >> element) {
		a.push_back(element);
	}
	bool getNegative = true;
	for (int i = 0; i < a.size() - 1; i++) {
		if (abs(a[i]) % 2 == 1 && a[i + 1] % 2 == 0) {
			getNegative = false;
			break;
		}
	}
	if (getNegative) {
		for (int i = a.size() - 1; i >= 0; i--) {
			if (a[i] < 0) {
				b.push_back(a[i]);
			}
		}
	} else {
		for (int i = a.size() - 1; i >= 0; i--) {
			if (a[i] > 0) {
				b.push_back(a[i]);
			}
		}
	}
 	for (int i = 0; i < b.size(); i++) {
		cout << b[i] << " ";
	}
	return 0;
}