#include <iostream>
using namespace std;
#if 1
//Q1
int main() {
unsigned A, B;
cin >> hex >> A >> B;
//--------ここから--------
unsigned T;
T = A;
A = B;
B = T;
//--------ここまで--------
//一時変数Tを使ってしまっているので解答にはならない
//それを無視した場合配点は(10-4)x2+15=27点
cout << hex << "0x" << A << " 0x" << B << endl;
}
#else
//Q2
int main() {
unsigned A;
cin >> hex >> A;
//--------ここから--------
unsigned T=0;
for(int i=0,j=31; i<16; ++i,--j) {
T |= (A & (1<<i)) << j-i;
T |= (A & (1<<j)) >> j-i;
}
A=T;
//--------ここまで--------
//(10-6)*2=8点
cout << hex << "0x" << A << endl;
}
#endif
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCiNpZiAxCgovL1ExCmludCBtYWluKCkgewoJdW5zaWduZWQgQSwgQjsKCWNpbiA+PiBoZXggPj4gQSA+PiBCOwoJLy8tLS0tLS0tLeOBk+OBk+OBi+OCiS0tLS0tLS0tCgl1bnNpZ25lZCBUOwoJVCA9IEE7CglBID0gQjsKCUIgPSBUOwoJLy8tLS0tLS0tLeOBk+OBk+OBvuOBpy0tLS0tLS0tCgkvL+S4gOaZguWkieaVsFTjgpLkvb/jgaPjgabjgZfjgb7jgaPjgabjgYTjgovjga7jgafop6PnrZTjgavjga/jgarjgonjgarjgYQKCS8v44Gd44KM44KS54Sh6KaW44GX44Gf5aC05ZCI6YWN54K544GvKDEwLTQpeDIrMTU9MjfngrkKCWNvdXQgPDwgaGV4IDw8ICIweCIgPDwgQSA8PCAiIDB4IiA8PCBCIDw8IGVuZGw7Cn0KCiNlbHNlCgovL1EyCmludCBtYWluKCkgewoJdW5zaWduZWQgQTsKCWNpbiA+PiBoZXggPj4gQTsKCS8vLS0tLS0tLS3jgZPjgZPjgYvjgoktLS0tLS0tLQoJdW5zaWduZWQgVD0wOwoJZm9yKGludCBpPTAsaj0zMTsgaTwxNjsgKytpLC0taikgewoJCVQgfD0gKEEgJiAoMTw8aSkpIDw8IGotaTsKCQlUIHw9IChBICYgKDE8PGopKSA+PiBqLWk7Cgl9CglBPVQ7CgkvLy0tLS0tLS0t44GT44GT44G+44GnLS0tLS0tLS0KCS8vKDEwLTYpKjI9OOeCuQoJY291dCA8PCBoZXggPDwgIjB4IiA8PCBBIDw8IGVuZGw7Cn0KCiNlbmRpZgo=