#include #include int main() { int n; std::cin >> n; // Number of elements std::queue oddQueue, evenQueue; for (int i = 0; i < n; i++) { int num; std::cin >> num; if (num % 2 == 0) evenQueue.push(num); // Even numbers else oddQueue.push(num); // Odd numbers } // Print odd numbers first while (!oddQueue.empty()) { std::cout << oddQueue.front() << " "; oddQueue.pop(); } // Print even numbers after while (!evenQueue.empty()) { std::cout << evenQueue.front() << " "; evenQueue.pop(); } std::cout << std::endl; return 0; }