← Home
package main

import (
	"fmt"
	"io"
	"os"
)

func main() {
	buf, _ := io.ReadAll(os.Stdin)
	var pos int
	nextInt := func() int {
		for pos < len(buf) && buf[pos] <= ' ' {
			pos++
		}
		if pos >= len(buf) {
			return 0
		}
		res := 0
		for pos < len(buf) && buf[pos] > ' ' {
			res = res*10 + int(buf[pos]-'0')
			pos++
		}
		return res
	}

	n := nextInt()
	m := nextInt()
	k := nextInt()

	u := make([]int, m)
	v := make([]int, m)
	l := make([]int, m)

	for i := 0; i < m; i++ {
		u[i] = nextInt()
		v[i] = nextInt()
		l[i] = nextInt()
	}

	isStorage := make([]bool, n+1)
	for i := 0; i < k; i++ {
		s := nextInt()
		isStorage[s] = true
	}

	minL := -1
	for i := 0; i < m; i++ {
		if isStorage[u[i]] != isStorage[v[i]] {
			if minL == -1 || l[i] < minL {
				minL = l[i]
			}
		}
	}

	fmt.Println(minL)
}