#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define mod 1000000007
#define INF 1000000000
#define LLINF 2000000000000000000LL

#define SIZE 100000
#define MAXLOG 18

int n,m,k,q;
vector<pair<int,int> > way[SIZE],tree[SIZE];
vector<pair<int,pair<int,int> > > way2;
bool visit[SIZE];
int dis[SIZE];

int ufdata[SIZE];

int ufroot(int a){
    if(ufdata[a]==-1) return a;
    return ufdata[a] = ufroot(ufdata[a]);
}

bool ufset(int a,int b){
    a = ufroot(a);
    b = ufroot(b);
    
    if(a==b) return false;
    ufdata[a] = b;
    return true;
}

//LCA
int parent[MAXLOG][SIZE];
int min_dis[MAXLOG][SIZE];
int depth[SIZE];

void lcadfs(int now,int h=0,int back=-1){
    parent[0][now] = back;
    depth[now] = h;
    
    for(int i=0;i<tree[now].size();i++){
        if(tree[now][i].first!=back){
            min_dis[0][tree[now][i].first] = tree[now][i].second;
            lcadfs(tree[now][i].first,h+1,now);
        }
    }
}

int main(){
    int a,b,c;
    
    scanf("%d%d%d%d",&n,&m,&k,&q);
    
    for(int i=0;i<m;i++){
        scanf("%d%d%d",&a,&b,&c);
        a--;
        b--;
        way[a].push_back({b,c});
        way[b].push_back({a,c});
        
        way2.push_back({0,{a,b}});
    }
    
    //dijkstra
    priority_queue<pair<int,int> > pq;
    
    for(int i=0;i<k;i++){
        scanf("%d",&a);
        a--;
        pq.push({0,a});
    }
    
    while(pq.size()){
        pair<int,int> p = pq.top();
        pq.pop();
        
        int now = p.second;
        int now_dis = p.first;
        
        if(visit[now]) continue;
        visit[now] = true;
        
        dis[now] = -now_dis;
        
        for(int i=0;i<way[now].size();i++){
            pq.push({now_dis-way[now][i].second,way[now][i].first});
        }
    }
    
    //?????§??¨?????¨
    
    for(int i=0;i<way2.size();i++){
        way2[i].first = -1 * min(dis[way2[i].second.first],dis[way2[i].second.second]);
    }
    
    for(int i=0;i<n;i++) ufdata[i]=-1;
    
    sort(way2.begin(),way2.end());
    
    assert(m==(int)way2.size());
    
    for(int i=0;i<m;i++){
        a = way2[i].second.first;
        b = way2[i].second.second;
        c = -way2[i].first;
        
        if(ufset(a,b)){
            tree[a].push_back({b,c});
            tree[b].push_back({a,c});
        }
    }
    
    
    //LCA
    for(int i=0;i<MAXLOG;i++){
        for(int j=0;j<n;j++){
            parent[i][j] = -1;
            min_dis[i][j] = INF;
        }
    }
    
    lcadfs(0); //root = 0
    
    for(int i=0;i<MAXLOG-1;i++){
        for(int j=0;j<n;j++){
            if(parent[i][j]!=-1){
                parent[i+1][j] = parent[i][parent[i][j]];
                
                if(parent[i+1][j]!=-1)
                    min_dis[i+1][j] = min(min_dis[i][j],min_dis[i][parent[i][j]]);
            }
        }
    }
    
    
    for(int i=0;i<q;i++){
        scanf("%d%d",&a,&b);
        a--;
        b--;
        
        int ans = INF;
        
        if(depth[a] < depth[b]) swap(a,b);
        
        int d = depth[a] - depth[b];
        
        for(int j=0;d>0;j++){
            if(d%2){
                ans = min(ans,min_dis[j][a]);
                a = parent[j][a];
            }
            d/=2;
        }
        
        if(a!=b){
            for(int j=MAXLOG-1;j>=0;j--){
                
                if(parent[j][a]!=parent[j][b]){
                    ans = min(ans,min_dis[j][a]);
                    ans = min(ans,min_dis[j][b]);
                    a = parent[j][a];
                    b = parent[j][b];
                }
            }
            
            ans = min(ans,min_dis[0][a]);
            ans = min(ans,min_dis[0][b]);
            a = parent[0][a];
            b = parent[0][b];
        }
        
        assert(a==b && a!=-1);
        
        printf("%d\n",ans);
    }
    
    return 0;
}

Measured memory_bytes: 34588