## constant

MAX_INT = 1 << 30

### subroutines

def root_uft(uft, i)
  return nil if uft[i].nil?
  i0 = i
  while uft[i0][0] != i0
    i0 = uft[i0][0]
  end
  uft[i][0] = i0
end

def merge_uft(uft, i, j)
  return nil if uft[i].nil? || uft[j].nil?
  i0 = root_uft(uft, i)
  si = uft[i0][1]
  j0 = root_uft(uft, j)
  sj = uft[j0][1]

  if si >= sj
    uft[i0][1] = si + sj
    uft[j0][0] = i0
  else
    uft[j0][1] = si + sj
    uft[i0][0] = j0
  end
end

### main

n, m, kn, qn = gets.strip.split(' ').map{|s| s.to_i}

edges = {}

m.times do
  ai, bi, li = gets.strip.split(' ').map{|s| s.to_i}
  ai -= 1
  bi -= 1

  edges[ai] = {} if edges[ai].nil?
  edges[bi] = {} if edges[bi].nil?
  edges[ai][bi] = edges[bi][ai] = li
end
#p edges

nbrs = {}
edges.keys.each{|k| nbrs[k] = edges[k].keys}
#p nbrs

dists = n.times.map{MAX_INT}
q = []

kn.times do
  fi = gets.strip.to_i - 1
  dists[fi] = 0
  q << fi
end
#p dists

while ! q.empty?
  u = q.min{|a, b| dists[a] <=> dists[b]}
  q.delete u

  du = dists[u]

  for v in nbrs[u]
    dv = dists[v]
    duv = dists[u] + edges[u][v]
    if dv > duv
      dists[v] = duv
      if dv >= MAX_INT
        q << v
      end
    end
  end
end
#p dists

dsorts = (0...n).map{|i| [dists[i], i]}.sort.reverse
#p dsorts

qn.times do
  si, ti = gets.strip.split(' ').map{|s| s.to_i - 1}

  min_dist = [dists[si], dists[ti]].min
  #p [si, ti, min_dist]

  uft = n.times.map{nil}

  uft[si] = [si, 1]
  uft[ti] = [ti, 1]
  if ! edges[si][ti].nil?
    merge_uft(uft, si, ti)
  end
  #p [si, root_uft(uft, si), ti, root_uft(uft, ti)]

  dsorts0 = dsorts.clone

  while root_uft(uft, si) != root_uft(uft, ti)
    max_d = dsorts0.shift[1]
    while ! uft[max_d].nil?
      max_d = dsorts0.shift[1]
    end

    uft[max_d] = [max_d, 1]

    for v in nbrs[max_d]
      if ! uft[v].nil?
        merge_uft(uft, v, max_d)
      end
    end

    min_dist = dists[max_d] if min_dist > dists[max_d]
  end

  puts min_dist
end