import sys

def MI(): return list(map(int,sys.stdin.readline().rstrip().split()))





N,L,T = MI()

q,r = T//L,T % L

A = []

a = 0  # 開始時点で、(時計回りの蟻の数)-(半時計まわりの蟻)

for i in range(N):

    x,w = MI()

    if w == 1:

        a += 1

        for j in range(-1,2):

            A.append(x+r+j*L)

    else:

        a -= 1

        for j in range(-1,2):

            A.append(x-r+j*L)

A.sort()

ANS = [A[i] % L for i in range(N,2*N)]

for i in range(N):

    print((ANS[(i+q*a) % N]))

import sys

def MI(): return map(int,sys.stdin.readline().rstrip().split())





N,L,T = MI()

q,r = T//L,T % L

A = []

a = 0  # 開始時点で、(時計回りの蟻の数)-(半時計まわりの蟻)

for i in range(N):

    x,w = MI()

    a += (-2)*w+3

    for j in range(-1,2):

        A.append(x+r*((-2)*w+3)+j*L)

A.sort()



print(*[A[N+(i+q*a)%N] % L for i in range(N)],sep='\n')

import sys


def MI():
    return list(map(int, sys.stdin.readline().rstrip().split()))


N, L, T = MI()
q, r = T // L, T % L
A = []
a = 0  # 開始時点で、(時計回りの蟻の数)-(半時計まわりの蟻)
for i in range(N):
    x, w = MI()
    if w == 1:
        a += 1
        for j in range(-1, 2):
            A.append(x + r + j * L)
    else:
        a -= 1
        for j in range(-1, 2):
            A.append(x - r + j * L)
A.sort()
ANS = [A[i] % L for i in range(N, 2 * N)]
for i in range(N):
    print((ANS[(i + q * a) % N]))

import sys


def MI():
    return map(int, sys.stdin.readline().rstrip().split())


N, L, T = MI()
q, r = T // L, T % L
A = []
a = 0  # 開始時点で、(時計回りの蟻の数)-(半時計まわりの蟻)
for i in range(N):
    x, w = MI()
    a += (-2) * w + 3
    for j in range(-1, 2):
        A.append(x + r * ((-2) * w + 3) + j * L)
A.sort()
print(*[A[N + (i + q * a) % N] % L for i in range(N)], sep="\n")

-    return list(map(int, sys.stdin.readline().rstrip().split())) +    return map(int, sys.stdin.readline().rstrip().split()) -    if w == 1: -        a += 1 -        for j in range(-1, 2): -            A.append(x + r + j * L) -    else: -        a -= 1 -        for j in range(-1, 2): -            A.append(x - r + j * L) +    a += (-2) * w + 3 +    for j in range(-1, 2): +        A.append(x + r * ((-2) * w + 3) + j * L) -ANS = [A[i] % L for i in range(N, 2 * N)] -for i in range(N): -    print((ANS[(i + q * a) % N])) +print(*[A[N + (i + q * a) % N] % L for i in range(N)], sep="\n")