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
#include <bits/stdc++.h>

using namespace std;

signed main(){

    string v;
    cin>>v;

    int a, b;
    cin>>a>>b;

    if(v == "Algosia"){
        a = (a + 1) % 1000 + 1;
        b = (b + 1) % 1000 + 1;
    }
    else{
        a = (a - 3 + 1000) % 1000 + 1;
        b = (b - 3 + 1000) % 1000 + 1;
    }

    cout<<a<<' '<<b;

    cout.flush();


    return 0;

}