1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include<bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin >> s;
    if (s == "Algosia") {
        int a, b;
        cin >> a >> b;
        if (a + b != 1001) {
            cout << 1001 - a << " " << 1001 - b << endl;
        }
        else {
            int x = (a + 1) % 1000 + 1;
            int y = 1001 - x;
            cout << x << " " << y << endl;
        }
    }
    else {
        int a, b;
        cin >> a >> b;
        if (a + b != 1001) {
            cout << 1001 - a << " " << 1001 - b << endl;
        }
        else {
            int x = (a - 3 + 1000) % 1000 + 1;
            int y = 1001 - x;
            cout << x << " " << y << endl;
        }
    }
}