def mult(a, b): return (a[0] * b[0] - a[1] * b[1], a[0] * b[1] + a[1] * b[0]) def su(a, b): return (a[0] + b[0], a[1] + b[1]) N, px, py = map(int, input().split()) p = (px, py) X = [] for _ in range(N): q = [int(a) for a in input().split()] X.append(q) ANS = [] m = (1, 0) d = (0, 0) for q in X[::-1]: if q[0] == 1: r, s = (1, 0), (q[1], 0) elif q[0] == 2: r, s = (1, 0), (0, q[1]) else: r, s = (0, -1), (0, 0) m = mult(m, r) d = su(mult(s, m), d) ANS.append(su(mult(p, m), d)) for x, y in ANS[::-1]: print(x, y)