#include <iostream>
#include <vector>
#include <algorithm>
int main() {
int sz;
std::cin >> sz;
std::vector<int> v(sz);
for(auto &elem : v){
std::cin >> elem;
std::cout << elem << ' '; //1 6 10 8 4
}
std::cout << std::endl;
std::sort(v.begin(), v.end());
for (auto elem : v) {
std::cout << elem << ' '; //0 0 0 0 0
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgoKaW50IG1haW4oKSB7CiAgICBpbnQgc3o7CiAgICBzdGQ6OmNpbiA+PiBzejsKCiAgICBzdGQ6OnZlY3RvcjxpbnQ+IHYoc3opOwogICAgZm9yKGF1dG8gJmVsZW0gOiB2KXsKICAgICAgICBzdGQ6OmNpbiA+PiBlbGVtOwogICAgICAgIHN0ZDo6Y291dCA8PCBlbGVtIDw8ICcgJzsgLy8xIDYgMTAgOCA0CiAgICB9CiAgICBzdGQ6OmNvdXQgPDwgc3RkOjplbmRsOwoKICAgIHN0ZDo6c29ydCh2LmJlZ2luKCksIHYuZW5kKCkpOwoKICAgIGZvciAoYXV0byBlbGVtIDogdikgewogICAgICAgIHN0ZDo6Y291dCA8PCBlbGVtIDw8ICcgJzsgLy8wIDAgMCAwIDAgCiAgICB9CiAgICByZXR1cm4gMDsKfQ==