#include <iostream>
using namespace std;
class TwoNumbers {
const int THOUSAND = 1000;
const int HUNDRED = 100;
const int TEN = 10;
int a, b;
public:
TwoNumbers(int a, int b) {
this->a = a;
this->b = b;
}
void specialChanging() {
a -= (a / HUNDRED - b % TEN) * HUNDRED;
b -= (b / THOUSAND - a % TEN) * THOUSAND;
}
int geta() {
return a;
}
int getb() {
return b;
}
};
int main() {
int a, b;
cin >> a >> b;
TwoNumbers twoNumbers(a, b);
cout << twoNumbers.geta() << ' ' << twoNumbers.getb() << '\n';
twoNumbers.specialChanging();
cout << twoNumbers.geta() << ' ' << twoNumbers.getb();
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgVHdvTnVtYmVycyB7CiAgICBjb25zdCBpbnQgVEhPVVNBTkQgPSAxMDAwOwogICAgY29uc3QgaW50IEhVTkRSRUQgPSAxMDA7CiAgICBjb25zdCBpbnQgVEVOID0gMTA7CiAgICBpbnQgYSwgYjsKICAgIAogICAgcHVibGljOgogICAgVHdvTnVtYmVycyhpbnQgYSwgaW50IGIpIHsKICAgICAgICB0aGlzLT5hID0gYTsKICAgICAgICB0aGlzLT5iID0gYjsKICAgIH0KICAgIAogICAgdm9pZCBzcGVjaWFsQ2hhbmdpbmcoKSB7CiAgICAgICAgYSAtPSAoYSAvIEhVTkRSRUQgLSBiICUgVEVOKSAqIEhVTkRSRUQ7CiAgICAgICAgYiAtPSAoYiAvIFRIT1VTQU5EIC0gYSAlIFRFTikgKiBUSE9VU0FORDsKICAgIH0KICAgIAogICAgaW50IGdldGEoKSB7CiAgICAgICAgcmV0dXJuIGE7CiAgICB9CiAgICAKICAgIGludCBnZXRiKCkgewogICAgCXJldHVybiBiOwogICAgfQp9OwoKaW50IG1haW4oKSB7CiAgICBpbnQgYSwgYjsKICAgIGNpbiA+PiBhID4+IGI7CiAgICBUd29OdW1iZXJzIHR3b051bWJlcnMoYSwgYik7CiAgICBjb3V0IDw8IHR3b051bWJlcnMuZ2V0YSgpIDw8ICcgJyA8PCB0d29OdW1iZXJzLmdldGIoKSA8PCAnXG4nOwogICAgdHdvTnVtYmVycy5zcGVjaWFsQ2hhbmdpbmcoKTsKICAgIGNvdXQgPDwgdHdvTnVtYmVycy5nZXRhKCkgPDwgJyAnIDw8IHR3b051bWJlcnMuZ2V0YigpOwogICAgcmV0dXJuIDA7Cn0=