#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}
pii Dir [] = {
	{ 1,0 },{ 0,1 }
};


struct UnionFind_P {
private:
	vector<int> data;
	int root(int x) {
		return data[x] < 0 ? x : root(data[x]);
	}

public:
	vector<vector<pii>> tb;
	int s_cou = 0;
	UnionFind_P(int size) : tb(size, vector<pii>(1)), data(size, -1) {
		REP(i, size) {
			tb[i][0] = { 0, i };
		}
	}
	bool unionSet(int x, int y, int t) { //????????\??£??????????????¨ y?????\??£?????????????????????
		x = root(x); y = root(y);
		s_cou++;
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
			if (tb[y][tb[y].size() - 1].first != t)
				tb[y].push_back({ t,x });
			else
				tb[y][tb[y].size() - 1].second = x;
		}
		return x != y;
	}
	int find(int u, int t) {
		auto itr = --upper_bound(ALL(tb[u]), MP(t, INT_MAX));
		return itr->second == u ? u : find(itr->second, t);
	}
};

signed main() {
	int n, m, k, q;
	scanf("%d %d %d %d", &n, &m, &k, &q);
	vector<vector<pii>> g(n + 1);
	vector<pair<int, pii>> es(m);
	REP(i, m) {
		int a, b, c;
		scnaf("%d %d %d", &a, &b, &c);
		a--; b--;
		g[a].push_back({ b,c });
		g[b].push_back({ a,c });
		es[i] = { -1,{ a,b } };
	}
	REP(i, k) {
		int a;
		scanf("%d", &a);
		a--;
		g[n].push_back({ a,0 });
	}

	priority_queue<pii, vector<pii>, greater<pii>> pq;
	pq.push({ 0, n });
	vector<int> al(n + 1,-1);
	while (!pq.empty()) {
		pii cur = pq.top();
		pq.pop();

		if (al[cur.second] > -1)
			continue;
		al[cur.second] = cur.first;

		REP(i, g[cur.second].size()) {
			pq.push({ cur.first + g[cur.second][i].second, g[cur.second][i].first });
		}
	}
	vector<int> ax;
	REP(i, m) {
		es[i].first = -min(al[es[i].second.first], al[es[i].second.second]);
		ax.push_back(es[i].first);
	}
	sort(ALL(es));
	sort(ALL(ax));
	ax.erase(unique(ALL(ax)), ax.end());

	UnionFind_P uf(n);
	int bef = 1, cou = 0;
	REP(i, es.size()) {
		if (bef != es[i].first)
			cou++;
		bef = es[i].first;
		uf.unionSet(es[i].second.first, es[i].second.second, cou);
	}

	REP(i, q) {
		int a, b;
		scanf("%d %d", &a, &b);
		a--; b--;
		int l = 1, r = cou;
		while (1) {
			int mid = (l + r) / 2;
			int ar = uf.find(a, mid);
			int br = uf.find(b, mid);
			if (ar == br) {
				r = mid;
			}
			else
				l = mid+1;

			if (l == r) {
				printf("%d\n", -ax[l-1]);
				break;
			}
		}

	}

	return 0;
}

Measured memory_bytes: 21648