N, px, py = map(int, input().split()) C = [] for i in range(N): C.append(list(map(int, input().split()))) C.reverse() n = 0 def rot(x, y): return y, -x ans = [] for c in C: if c[0] == 3: n = (n + 1) % 4 elif c[0] == 1: px += c[1] else: py += c[1] x, y = px, py for _ in range(n): x, y = rot(x, y) ans.append((x, y)) ans.reverse() for x, y in ans: print(x, y)