#include <iostream>

void swap_values(int& left, int& right) {
    int saved{left};
    left = right;
    right = saved;
}

int main() {
    int x{2};
    int y{9};
    swap_values(x, y);
    std::cout << x << ' ' << y << '\n';
    swap_values(x, x);
    std::cout << x << ' ' << y << '\n';
    return 0;
}
