#include int main() { int N, Px, Py; std::cin >> N >> Px >> Py; int rot = 0, dx = 0, dy = 0; auto move = [&](const int Dx, const int Dy) { if (rot == 0) { dx += Dx, dy += Dy; } else if (rot == 1) { dx += Dy, dy -= Dx; } else if (rot == 2) { dx -= Dx, dy -= Dy; } else { dx -= Dy, dy += Dx; } }; std::string ans; auto answer = [&]() { int X, Y; if (rot == 0) { X = Px, Y = Py; } else if (rot == 1) { X = Py, Y = -Px; } else if (rot == 2) { X = -Px, Y = -Py; } else { X = -Py, Y = Px; } ans = std::to_string(X + dx) + " " + std::to_string(Y + dy) + "\n" + ans; }; using P = std::pair; using PP = std::pair; std::vector com; for (int i = 0; i < N; i++) { int Com, Dx = 0, Dy = 0; std::cin >> Com; if (Com == 1) { std::cin >> Dx; } else if (Com == 2) { std::cin >> Dy; } com.push_back({Com == 3, {Dx, Dy}}); } std::reverse(com.begin(), com.end()); for (const auto& c : com) { if (c.first) { (rot += 1) %= 4; } else { move(c.second.first, c.second.second); } answer(); } std::cout << ans << std::endl; return 0; }