// NOTA: si raccomanda di usare questo template anche se non lo si capisce completamente.

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>

#define MAXK 100000
#define MAXM 100000

int       K, M, N, T, i, test;
int       G[MAXK];
int       A[MAXM], B[MAXM];
long long ris;

int main() {
    // decommenta le due righe seguenti se vuoi leggere/scrivere da file
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    assert(1 == scanf("%d", &T));
    for (test = 1; test <= T; ++test) {
        assert(3 == scanf("%d%d%d", &N, &M, &K));

        for (i = 0; i < K; ++i)
            assert(1 == scanf("%d", &G[i]));

        for (i = 0; i < M; ++i)
            assert(2 == scanf("%d%d", &A[i], &B[i]));

        ris = 0;


        // INSERISCI IL TUO CODICE QUI


        printf("Case #%d: ", test);
        printf("%lld\n", ris);
    }

    return 0;
}
