# AOJ ITP2_4_A: Reverse

# Python3 2018.6.24 bal4u



n = int(eval(input()))

a = list(map(int, input().split()))

q = int(eval(input()))

for i in range(q):

	b, e = list(map(int, input().split()))

	s = a[b:e]

	s = s[::-1]

	for j in range(e-b): a[b+j] = s[j]

print((*a))

# AOJ ITP2_4_A: Reverse

# Python3 2018.6.24 bal4u



n = int(eval(input()))

a = list(map(int, input().split()))

q = int(eval(input()))

for i in range(q):

	b, e = list(map(int, input().split()))

	a = a[:b] + a[b:e][::-1] + a[e:]

print((*a))

# AOJ ITP2_4_A: Reverse
# Python3 2018.6.24 bal4u
n = int(eval(input()))
a = list(map(int, input().split()))
q = int(eval(input()))
for i in range(q):
    b, e = list(map(int, input().split()))
    s = a[b:e]
    s = s[::-1]
    for j in range(e - b):
        a[b + j] = s[j]
print((*a))

# AOJ ITP2_4_A: Reverse
# Python3 2018.6.24 bal4u
n = int(eval(input()))
a = list(map(int, input().split()))
q = int(eval(input()))
for i in range(q):
    b, e = list(map(int, input().split()))
    a = a[:b] + a[b:e][::-1] + a[e:]
print((*a))

-    s = a[b:e] -    s = s[::-1] -    for j in range(e - b): -        a[b + j] = s[j] +    a = a[:b] + a[b:e][::-1] + a[e:]