#include <iostream>
#include <utility>
template<typename T>
constexpr const T& mirror(const T& t)
{
return t;
}
template<class A, class B>
constexpr auto mirror(const std::pair<A, B>& p)
{
return std::make_pair(mirror(p.second), mirror(p.first));
}
int main() {
constexpr std::pair<int, float> a{42, 4.2f};
static_assert(std::make_pair(4.2f, 42) == mirror(a), "unexpected");
constexpr std::pair<int, std::pair<float, char>> b{0, {4.2f, '*'}};
static_assert(std::make_pair(std::make_pair('*', 4.2f), 0) == mirror(b), "unexpected");
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dXRpbGl0eT4KCgoKdGVtcGxhdGU8dHlwZW5hbWUgVD4KY29uc3RleHByIGNvbnN0IFQmIG1pcnJvcihjb25zdCBUJiB0KQp7CglyZXR1cm4gdDsKfQoKdGVtcGxhdGU8Y2xhc3MgQSwgY2xhc3MgQj4KY29uc3RleHByIGF1dG8gbWlycm9yKGNvbnN0IHN0ZDo6cGFpcjxBLCBCPiYgcCkKewoJcmV0dXJuIHN0ZDo6bWFrZV9wYWlyKG1pcnJvcihwLnNlY29uZCksIG1pcnJvcihwLmZpcnN0KSk7Cn0KCmludCBtYWluKCkgewoJY29uc3RleHByIHN0ZDo6cGFpcjxpbnQsIGZsb2F0PiBhezQyLCA0LjJmfTsKCQoJc3RhdGljX2Fzc2VydChzdGQ6Om1ha2VfcGFpcig0LjJmLCA0MikgPT0gbWlycm9yKGEpLCAidW5leHBlY3RlZCIpOwoJCgljb25zdGV4cHIgc3RkOjpwYWlyPGludCwgc3RkOjpwYWlyPGZsb2F0LCBjaGFyPj4gYnswLCB7NC4yZiwgJyonfX07CgkKCXN0YXRpY19hc3NlcnQoc3RkOjptYWtlX3BhaXIoc3RkOjptYWtlX3BhaXIoJyonLCA0LjJmKSwgMCkgPT0gbWlycm9yKGIpLCAidW5leHBlY3RlZCIpOwp9