#include <iostream>

int* choose(bool first, int& left, int& right) {
    if (first) {
        return &left;
    }
    return &right;
}

int main() {
    int x{2};
    int y{9};
    int* first{choose(true, x, y)};
    int* second{choose(false, x, y)};
    std::cout << *first << ' ' << *second << '\n';
    y = 10;
    std::cout << *second << '\n';
    if (*first != 2 || *second != 10 || x != 2 || y != 10) {
        std::cout << "wrong result" << '\n';
        return 1;
    }
    return 0;
}
