#include <bits/stdc++.h>
using namespace std;

const int maxn = (int) 1e5 + 5;
const int inf  = (int) 1e9 + 7;

int n, m, k, q;
int f[maxn];
int d[maxn];
vector<pair<int, int> > G[maxn];
vector<pair<int, pair<int, int> > > E;
vector<pair<int, int> > query[maxn];
int pset[maxn];
int ans[maxn];

int findset(int x) {
    if(x == pset[x]) return x;
    return pset[x] = findset(pset[x]);
}
bool issameset(int x, int y) {
    return findset(x) == findset(y);
}
void unionset(int x, int y) {
    int rx = findset(x);
    int ry = findset(y);
    if(rx != ry) {
        pset[rx] = ry;
    }
}

void bfs() {
    set<pair<int, int> > S;
    for (int i = 1; i <= n; i ++) d[i] = inf;
    for (int i = 1; i <= k; i ++) {
        S.insert(make_pair(0, f[i]));
        d[f[i]] = 0;
    }
    while (!S.empty()) {
        pair<int, int> ii = *S.begin();
        S.erase(S.begin());
        int du = ii.first;
        int u = ii.second;
        if(d[u] != du) continue;

        for (int i = 0; i < G[u].size(); i ++) {
            int v = G[u][i].first;
            int w = G[u][i].second;
            if(d[v] > du + w) {
                d[v] = du + w;
                S.insert(make_pair(d[v], v));
            }
        }
    }
}

int level[maxn];
int mn[maxn][20], M[maxn][20];

void dfs(int u) {
    for (int i = 0; i < G[u].size(); i ++) {
        int v = G[u][i].first;
        int w = G[u][i].second;
        if(v == M[u][0]) continue;
        M[v][0] = u;
        mn[v][0] = w;
        level[v] = level[u] + 1;
        dfs(v);
    }
}

void make_LCA() {
    for (int k = 1; k < 20 ; k ++)
        for (int i = 1; i <= n; i ++) {
            M[i][k] = M[M[i][k - 1]][k - 1];
            mn[i][k] = min(mn[i][k - 1], mn[M[i][k - 1]][k - 1]);
        }
}

int lca(int u, int v) {
    if(level[u] < level[v]) swap(u, v);
    int ret = inf;
    for (int i = 19; i >= 0; i --) {
        if(level[M[u][i]] >= level[v]) {
            ret = min(ret, mn[u][i]);
            u = M[u][i];
        }
    }
    if(u == v) return ret;
    for (int i = 19; i >= 0; i --) {
        if(M[u][i] != M[v][i]) {
            ret = min(ret, mn[u][i]);
            ret = min(ret, mn[v][i]);
            u = M[u][i];
            v = M[v][i];
        }
    }
    ret = min(ret, mn[u][0]);
    ret = min(ret, mn[v][0]);
    return ret;
}

int main() {
    ///freopen("test.txt", "r", stdin);
    ios_base::sync_with_stdio(0);

    cin >> n >> m >> k >> q;
    for (int i = 1; i <= m; i ++) {
        int a, b, l; cin >> a >> b >> l;
        E.push_back(make_pair(0, make_pair(a, b)));
        G[a].push_back(make_pair(b, l));
        G[b].push_back(make_pair(a, l));
    }
    for (int i = 1; i <= k; i ++) cin >> f[i];
    bfs();
    ///for (int i = 1; i <= n; i ++) cout << i << ' ' << d[i] << endl;
    for (int i = 0; i < E.size(); i ++) {
        int u = E[i].second.first;
        int v = E[i].second.second;
        E[i].first = min(d[u], d[v]);
        ///cout << E[i].first << ' ' << u << ' ' << v << endl;
    }

    sort(E.begin(), E.end());
    reverse(E.begin(), E.end());
    for (int i = 0; i <= n; i ++) {
        G[i].clear();
        pset[i] = i;
    }
    for (int i = 0; i < E.size(); i ++) {
        int u = E[i].second.first;
        int v = E[i].second.second;
        int dist = E[i].first;
        ///cout << findset(u) << ' ' << findset(v) << endl;
        if(!issameset(u, v)) {
            ///cout << u << ' ' << v << ' ' << dist << endl;
            unionset(u, v);
            G[u].push_back(make_pair(v, dist));
            G[v].push_back(make_pair(u, dist));
        }
    }
    ///cout << endl;
    level[1] = 1;
    dfs(1);
    make_LCA();
    ///cout << lca(5, 2) << endl;
    ///return 0;
    for (int i = 1; i <= q; i ++) {
        int s, t; cin >> s >> t;
        cout << lca(s, t) << endl;
    }
}

Measured memory_bytes: 35104