private void solve() throws Exception {
		String firstLine = bufferedReader.readLine();
		String[] split = firstLine.split(" ");
		n = Integer.valueOf(split[0]);
		m = Integer.valueOf(split[1]);
		t = Integer.valueOf(split[2]);
		String[] split2 = bufferedReader.readLine().split(" ");
		s = Integer.valueOf(split2[0]) - 1;
		g = Integer.valueOf(split2[1]) - 1;
		h = Integer.valueOf(split2[2]) - 1;
		c = new int[n][n];
		ts = new int[t];

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				c[i][j] = c[j][i] = -1;
			}
		}

		for (int i = 0; i < m; i++) {
			String[] s = bufferedReader.readLine().split(" ");
			Integer a = Integer.valueOf(s[0]) - 1;
			Integer b = Integer.valueOf(s[1]) - 1;
			Integer d = Integer.valueOf(s[2]);
			c[a][b] = c[b][a] = d;
		}
		for (int i = 0; i < t; i++) {
			ts[i] = Integer.valueOf(bufferedReader.readLine()) - 1;
		}

		Arrays.sort(ts);
		oldd = sp(s);
		if (oldd[g] < oldd[h]) {
			newd = sp(h);
			for (int i = 0; i < t; i++) {
				int actual = ts[i];
				if (oldd[actual] == oldd[g] + newd[actual] + c[g][h]) {
					System.err.print((actual + 1) + " ");
				}
			}
			System.err.println();
		} else {
			newd = sp(g);
			for (int i = 0; i < t; i++) {
				int actual = ts[i];
				if (oldd[actual] == oldd[h] + newd[actual] + c[h][g]) {
					System.err.print((actual + 1) + " ");
				}
			}
			System.err.println();
		}
	}