N, K, Q = list(map(int, input().split()))

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

ans = float("inf")

for i in range(N):

    tmp = []

    rec = []

    for j in range(N):

        if a[i] <= a[j]:

            tmp.append(a[j])

        else:

            if len(tmp) >= K:

                tmp = sorted(tmp)

                rec += tmp[:len(tmp) - K + 1]

            tmp = []



    if len(tmp) >= K:

        tmp = sorted(tmp)

        rec += tmp[:len(tmp) - K + 1]

    if Q <= len(rec):

        rec = sorted(rec)

        ans = min(ans, rec[Q - 1] - rec[0])

print(ans)
N, K, Q = list(map(int, input().split()))

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

D = set()

for i in range(N):

    D.add(A[i])



D = list(D)

ans = float('inf')

for Y in D:

    T = []

    tmp = []

    for j in range(N):

        if A[j] >= Y:

            tmp.append(A[j])

        else:

            if len(tmp) >= K:

                tmp = sorted(tmp)

                T += tmp[:len(tmp) - K + 1]

            tmp = []



    if len(tmp) >= K:

        tmp = sorted(tmp)

        T += tmp[:len(tmp) - K + 1]



    if len(T) >= Q:

        T = sorted(T)

        T = T[:Q]

        ans = min(ans, T[-1] - T[0])



print(ans)

N, K, Q = list(map(int, input().split()))
a = list(map(int, input().split()))
ans = float("inf")
for i in range(N):
    tmp = []
    rec = []
    for j in range(N):
        if a[i] <= a[j]:
            tmp.append(a[j])
        else:
            if len(tmp) >= K:
                tmp = sorted(tmp)
                rec += tmp[: len(tmp) - K + 1]
            tmp = []
    if len(tmp) >= K:
        tmp = sorted(tmp)
        rec += tmp[: len(tmp) - K + 1]
    if Q <= len(rec):
        rec = sorted(rec)
        ans = min(ans, rec[Q - 1] - rec[0])
print(ans)

N, K, Q = list(map(int, input().split()))
A = list(map(int, input().split()))
D = set()
for i in range(N):
    D.add(A[i])
D = list(D)
ans = float("inf")
for Y in D:
    T = []
    tmp = []
    for j in range(N):
        if A[j] >= Y:
            tmp.append(A[j])
        else:
            if len(tmp) >= K:
                tmp = sorted(tmp)
                T += tmp[: len(tmp) - K + 1]
            tmp = []
    if len(tmp) >= K:
        tmp = sorted(tmp)
        T += tmp[: len(tmp) - K + 1]
    if len(T) >= Q:
        T = sorted(T)
        T = T[:Q]
        ans = min(ans, T[-1] - T[0])
print(ans)

-a = list(map(int, input().split())) +A = list(map(int, input().split())) +D = set() +for i in range(N): +    D.add(A[i]) +D = list(D) -for i in range(N): +for Y in D: +    T = [] -    rec = [] -        if a[i] <= a[j]: -            tmp.append(a[j]) +        if A[j] >= Y: +            tmp.append(A[j]) -                rec += tmp[: len(tmp) - K + 1] +                T += tmp[: len(tmp) - K + 1] -        rec += tmp[: len(tmp) - K + 1] -    if Q <= len(rec): -        rec = sorted(rec) -        ans = min(ans, rec[Q - 1] - rec[0]) +        T += tmp[: len(tmp) - K + 1] +    if len(T) >= Q: +        T = sorted(T) +        T = T[:Q] +        ans = min(ans, T[-1] - T[0])