#include #include #include #include #include #include #include using namespace std; using ll = long long; struct P { int x, y, r; }; void rot(int& x, int& y, int r) { r &= 3; if (r == 0) { return; } else if (r == 1) { int t = x; x = -y; y = t; } else if (r == 2) { x = -x; y = -y; } else if (r == 3) { int t = x; x = y; y = -t; } } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, px, py; cin >> n >> px >> py; vector

p(n + 1); p[0] = { 0, 0, 0 }; int x = 0, y = 0, r = 0; for (int i = 0; i < n; i++) { int c; cin >> c; if (c != 3) { int d[2] = {}; cin >> d[c == 2]; rot(d[0], d[1], r); x += d[0]; y += d[1]; } else { r++; } p[i + 1] = { x, y, r }; } for (int i = 0; i < n; i++) { int x = px, y = py; rot(x, y, p[i].r); x += p[n].x - p[i].x; y += p[n].y - p[i].y; rot(x, y, -p[n].r); cout << x << ' ' << y << '\n'; } return 0; }