#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <typename T>
struct edge {
    int from, to; T cost;
    edge(int to, T cost) : from(-1), to(to), cost(cost) {}
    edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
};


int main() {
    int n, m;
    cin >> n >> m;
    vector<vector<edge<ll>>> G_(n);
    for (int i = 0; i < m; ++i) {
        int a, b; ll c;
        scanf("%d %d %lld", &a, &b, &c);
        a--; b--;
        G_[a].emplace_back(b, c);
        G_[b].emplace_back(a, c);
    }
    int a, b, q;
    cin >> a >> b >> q;
    a--; b--;
    vector<vector<int>> G(n);
    {
        vector<ll> d(n, INF<ll>);
        priority_queue<pair<ll, int>,vector<pair<ll, int>>,greater<>> Q;
        d[a] = 0;
        Q.emplace(0, a);
        while(!Q.empty()){
            int cost; int i;
            tie(cost, i) = Q.top(); Q.pop();
            if(d[i] < cost) continue;
            for (auto &&e : G_[i]) {
                auto cost2 = cost + e.cost;
                if(d[e.to] <= cost2) continue;
                d[e.to] = cost2;
                Q.emplace(d[e.to], e.to);
            }
        }
        for (int i = 0; i < n; ++i) {
            for (auto &&j : G_[i]) {
                if(d[i]+j.cost == d[j.to]) {
                    G[j.to].emplace_back(i);
                }
            }
        }

    }
    vector<vector<int>> G2(n);
    vector<int> ord;
    {
        vector<int> visited(n);
        visited[b] = 1;
        queue<int> Q;
        Q.emplace(b);
        vector<int> deg(n);
        while(!Q.empty()){
            int i = Q.front(); Q.pop();
            for (auto &&j : G[i]) {
                G2[j].emplace_back(i);
                deg[i]++;
                if(!visited[j]) {
                    visited[j] = 1;
                    Q.emplace(j);
                }
            }
        }
        for (int i = 0; i < n; ++i) {
            if(!deg[i]) Q.emplace(i);
        }
        while(!Q.empty()){
            int i = Q.front(); Q.pop();
            ord.emplace_back(i);
            for (auto &&j : G2[i]) {
                deg[j]--;
                if(!deg[j]) Q.emplace(j);
            }
        }
        reverse(ord.begin(),ord.end());
    }
    reverse(ord.begin(),ord.end());
    constexpr int B = 4096;
    vector<bitset<B>> v(n);
    vector<int> cs(q), ds(q);
    for (int i = 0; i < q; ++i) {
        scanf("%d %d", &cs[i], &ds[i]);
        cs[i]--; ds[i]--;
    }
    for (int l = 0; l < q; l += B) {
        int r = min(q, l+B);
        for (int j = 0; j < n; ++j) v[j].reset();
        for (int k = l; k < r; ++k) {
            v[cs[k]].set(k-l);
        }
        for (auto &&j : ord) {
            for (auto &&k : G2[j]) {
                v[k] |= v[j];
            }
        }
        for (int k = l; k < r; ++k) {
            if(v[ds[k]][k-l]) puts("Yes");
            else puts("No");
        }

    }
    return 0;
}


Measured memory_bytes: 76884