### constant

MAX_INT = (1 << 30)

### main

sn, rn = gets.strip.split(' ').map{|s| s.to_i}

nbrs = sn.times.map{[]}

rn.times do
  u, v, w = gets.strip.split(' ').map{|s| s.to_i}
  u -= 1
  v -= 1

  nbrs[u] << [v, w]
  nbrs[v] << [u, w]
end
#p nbrs

ta, tb, qn = gets.strip.split(' ').map{|s| s.to_i}
ta -= 1
tb -= 1

dists = sn.times.map{MAX_INT}
dists[ta] = 0

prevs = []
q = (0...sn).to_a

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

  next if u == tb

  for edge in nbrs[u]
    v, w = edge
    dist0 = dists[u] + w
    if dists[v] > dist0
      dists[v] = dist0
      prevs[v] = [u]
    elsif dists[v] == dist0
      prevs[v] << u
    end
  end
end
#p dists
#p prevs

onroutes = sn.times.map{false}
onroutes[tb] = true
q = [tb]

while ! q.empty?
  u = q.shift
  next if u == ta

  for v in prevs[u]
    if ! onroutes[v]
      onroutes[v] = true
      q << v
    end
  end
end
#p routes

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

  if onroutes[c] && onroutes[d] && dists[c] < dists[d]
    puts 'Yes'
  else
    puts 'No'
  end
end