N, L, T = list(map(int, input().split()))

gap = 0

X = [0] * N

for i in range(N):

    x, w = list(map(int, input().split()))

    x += ((w + 1) % 3 - 1) * T

    gap += x // L

    gap %= N

    X[i] = x % L

X.sort()

for i in range(N):

    print((X[(i+gap) % N]))
import sys

input = sys.stdin.readline

N, L, T = list(map(int, input().split()))

gap = 0

X = [0] * N

for i in range(N):

    x, w = list(map(int, input().split()))

    x += ((w + 1) % 3 - 1) * T

    gap += x // L

    gap %= N

    X[i] = x % L

X.sort()

for i in range(N):

    print((X[(i+gap) % N]))
N, L, T = list(map(int, input().split()))
gap = 0
X = [0] * N
for i in range(N):
    x, w = list(map(int, input().split()))
    x += ((w + 1) % 3 - 1) * T
    gap += x // L
    gap %= N
    X[i] = x % L
X.sort()
for i in range(N):
    print((X[(i + gap) % N]))

import sys

input = sys.stdin.readline
N, L, T = list(map(int, input().split()))
gap = 0
X = [0] * N
for i in range(N):
    x, w = list(map(int, input().split()))
    x += ((w + 1) % 3 - 1) * T
    gap += x // L
    gap %= N
    X[i] = x % L
X.sort()
for i in range(N):
    print((X[(i + gap) % N]))

+import sys + +input = sys.stdin.readline