N,L,T = map(int, input().split())
X = [0]*N
W = [0]*N
for n in range(N):
    X[n],W[n] = map(int, input().split())
index = 0
#after T
for n in range(N):
    X[n] += ((-1)**(W[n]+1))*T
    index += X[n]//L
    X[n] %= L
index %= N
X.sort()
X = X[index:] + X[:index] #No.1 wo hajimeni mottekuru.
for n in range(N):
    print(X[n])
d52a26461469b1a3a4e10b42218b6dca4c9784e6
<mask token>

<mask token>
for n in range(N):
    X[n], W[n] = map(int, input().split())
<mask token>
for n in range(N):
    X[n] += (-1) ** (W[n] + 1) * T
    index += X[n] // L
    X[n] %= L
index %= N
X.sort()
<mask token>
for n in range(N):
    print(X[n])

N, L, T = map(int, input().split())
X = [0] * N
W = [0] * N
for n in range(N):
    X[n], W[n] = map(int, input().split())
index = 0
for n in range(N):
    X[n] += (-1) ** (W[n] + 1) * T
    index += X[n] // L
    X[n] %= L
index %= N
X.sort()
X = X[index:] + X[:index]
for n in range(N):
    print(X[n])

N,L,T = map(int, input().split())
X = [0]*N
W = [0]*N
for n in range(N):
    X[n],W[n] = map(int, input().split())
index = 0
#after T
for n in range(N):
    X[n] += ((-1)**(W[n]+1))*T
    index += X[n]//L
    X[n] %= L
index %= N
X.sort()
X = X[index:] + X[:index] #No.1 wo hajimeni mottekuru.
for n in range(N):
    print(X[n])