#include #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) { 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 = (r + 3) % 4; } p[i + 1] = { x, y, r }; } for (int i = 0; i < n; i++) { int dx = p[n].x - p[i].x, dy = p[n].y - p[i].y, dr = (p[n].r - p[i].r + 4) % 4; int dr2 = (4 - dr) % 4; rot(dx, dy, dr); int x = px, y = py; rot(x, y, dr); cout << x + dx << ' ' << y + dy << '\n'; } return 0; }