Inversion Counting
A permutation of size n is an array of size n such that each integer from 1 to n occurs exactly once in this array. An inversion in a permutation p is a pair of indices (i, j) such that i > j and ai < aj. For example, a permutation [4, 1, 3, 2] contains 4 inversions: (2, 1), (3, 1), (4, 1), (4, 3).You are given a permutation a of size n and m queries to it. Each query is represented by two indices l and r denoting that you have to reverse the segment [l, r] of the permutation. For example, if a = [1, 2, 3, 4] and a query l = 2, r = 4 is applied, then the resulting permutation is [1, 4, 3, 2].After each query you have to determine whether the number of inversions is odd or even.
The first example:  after the first query a = [2, 1, 3], inversion: (2, 1);  after the second query a = [2, 3, 1], inversions: (3, 1), (3, 2). The second example:  a = [1, 2, 4, 3], inversion: (4, 3);  a = [3, 4, 2, 1], inversions: (3, 1), (4, 1), (3, 2), (4, 2), (4, 3);  a = [1, 2, 4, 3], inversion: (4, 3);  a = [1, 4, 2, 3], inversions: (3, 2), (4, 2). 
The first line contains one integer n (1 ≤ n ≤ 1500) — the size of the permutation. The second line contains n integers a1, a2, ..., an (1 ≤ ai ≤ n) — the elements of the permutation. These integers are pairwise distinct.The third line contains one integer m (1 ≤ m ≤ 2·105) — the number of queries to process.Then m lines follow, i-th line containing two integers li, ri (1 ≤ li ≤ ri ≤ n) denoting that i-th query is to reverse a segment [li, ri] of the permutation. All queries are performed one after another.
Print m lines. i-th of them must be equal to odd if the number of inversions in the permutation after i-th query is odd, and even otherwise.
from sys import stdin
n = int(stdin.readline())
a = [int(o) for o in stdin.readline().split()]
inv = len([1 for i in range(n) for j in range(i + 1, n) if a[i] > a[j]])
ans = inv % 2
m = int(stdin.readline())
output = []
for i in range(m):
    (l, r) = map(int, stdin.readline().split())
    v = (r - l + 1) * (r - l) // 2 % 2
    ans ^= v
    if ans == 0:
        output.append('even')
    else:
        output.append('odd')
print('\n'.join(output))
def solve():
    n = int(input())
    a = list(map(int, input().split()))
    cl = ['odd', 'even']
    m = int(input())
    ans = True
    b = []
    ap = b.append
    for i in range(n):
        for j in range(i):
            if a[j] > a[i]:
                ans = not ans
    for i in range(m):
        (left, right) = map(int, input().split())
        if (right - left + 1) // 2 % 2 == 1:
            ans = not ans
        ap(cl[ans])
    print('\n'.join(b))
solve()
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 15
mod = 10 ** 9 + 7

def LI():
    return [int(x) for x in sys.stdin.readline().split()]

def LI_():
    return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
    return [float(x) for x in sys.stdin.readline().split()]

def LS():
    return sys.stdin.readline().split()

def I():
    return int(sys.stdin.readline())

def F():
    return float(sys.stdin.readline())

def S():
    return input()

def pf(s):
    return print(s, flush=True)

def main():
    n = I()
    a = LI()
    q = I()
    b = [LI() for _ in range(q)]
    t = 0
    for i in range(n):
        for j in range(i + 1, n):
            if a[i] > a[j]:
                t += 1
    r = []
    for (c, d) in b:
        k = d - c + 1
        if k * (k - 1) // 2 % 2 == 1:
            t += 1
        if t % 2 == 0:
            r.append('even')
        else:
            r.append('odd')
    return '\n'.join(r)
print(main())