N, M = list(map(int, input().split()))

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

ten = [[] for _ in range(N)]



for i in range(M):

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

    a -= 1

    b -= 1

    ten[a].append(b)

    ten[b].append(a)

ans = 0

for i in range(N):

    flag = True

    for j in ten[i]:

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

            flag = False

    if flag:

        ans += 1

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

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



l = [[] for _ in range(N)]



for _ in range(M):

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

    a -= 1

    b -= 1

    l[a].append(b)

    l[b].append(a)



ng = 0



for i in range(N):

    for other in l[i]:

        if H[i] <= H[other]:

            ng += 1

            break

ans = N - ng

print(ans)
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
ten = [[] for _ in range(N)]
for i in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    ten[a].append(b)
    ten[b].append(a)
ans = 0
for i in range(N):
    flag = True
    for j in ten[i]:
        if H[i] <= H[j]:
            flag = False
    if flag:
        ans += 1
print(ans)

N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
l = [[] for _ in range(N)]
for _ in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    l[a].append(b)
    l[b].append(a)
ng = 0
for i in range(N):
    for other in l[i]:
        if H[i] <= H[other]:
            ng += 1
            break
ans = N - ng
print(ans)

-ten = [[] for _ in range(N)] -for i in range(M): +l = [[] for _ in range(N)] +for _ in range(M): -    ten[a].append(b) -    ten[b].append(a) -ans = 0 +    l[a].append(b) +    l[b].append(a) +ng = 0 -    flag = True -    for j in ten[i]: -        if H[i] <= H[j]: -            flag = False -    if flag: -        ans += 1 +    for other in l[i]: +        if H[i] <= H[other]: +            ng += 1 +            break +ans = N - ng