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
#include "bits/stdc++.h"
using namespace std;

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    string kto;
    cin>>kto;
    if(kto == "Algosia"){
        int a,b;
        cin>>a>>b;
        int c = (a + abs(b-a) + 1)%1001, d = (b + abs(b-a) + 1)%1001;
        cout<<c<<" "<<d<<endl;
        cout.flush();

    }
    else{
        int c,d;
        cin>>c>>d;
        int a = (c - abs(d-c) + 1000)%1001, b = (d - abs(d-c) + 1000)%1001;
        cout<<a<<" "<<b<<endl;
        cout.flush();
    }
    cout.flush();
    return 0;
}