#include <iostream>
#include <vector>

int main() {
    std::vector<int> arr = {3, 1, 2, 4, 6, 5};
    int left = 0;
    int right = arr.size() - 1;

    while (left < right) {
        while (arr[left] % 2 == 0 && left < right) left++;
        while (arr[right] % 2 != 0 && left < right) right--;
        if (left < right) {
            std::swap(arr[left], arr[right]);
            left++;
            right--;
        }
    }

    for (int num : arr) {
        std::cout << num << " ";
    }
    return 0;
}

