n = int(input())

deck = [i for i in range(1,2*n+1)]

m = int(input())

for i in range(m):

    k = int(input())

    if k == 0:

        for j in range(n):

            deck += [deck[j]]+[deck[n+j]]

        deck = deck[2*n:]

    else:

        deck = deck[k:]+deck[:k]

for i in deck:

    print(i)
n = int(input())

d = [i for i in range(1,2*n+1)]

m = int(input())

for i in range(m):

    k = int(input())

    if k == 0:

        for j in range(n):

            d += [d[j]]+[d[n+j]]

        d = d[2*n:]

    else:

        d = d[k:]+d[:k]

for i in d:

    print(i)
n = int(input())
deck = [i for i in range(1, 2 * n + 1)]
m = int(input())
for i in range(m):
    k = int(input())
    if k == 0:
        for j in range(n):
            deck += [deck[j]] + [deck[n + j]]
        deck = deck[2 * n :]
    else:
        deck = deck[k:] + deck[:k]
for i in deck:
    print(i)

n = int(input())
d = [i for i in range(1, 2 * n + 1)]
m = int(input())
for i in range(m):
    k = int(input())
    if k == 0:
        for j in range(n):
            d += [d[j]] + [d[n + j]]
        d = d[2 * n :]
    else:
        d = d[k:] + d[:k]
for i in d:
    print(i)

-deck = [i for i in range(1, 2 * n + 1)] +d = [i for i in range(1, 2 * n + 1)] -            deck += [deck[j]] + [deck[n + j]] -        deck = deck[2 * n :] +            d += [d[j]] + [d[n + j]] +        d = d[2 * n :] -        deck = deck[k:] + deck[:k] -for i in deck: +        d = d[k:] + d[:k] +for i in d: