#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;

#define NMAX 100000
#define EMAX 200000
#define INFTY (1<<21)
#define LIM 64
vector<pair<int, int> > G[NMAX];
vector<int> DAG[NMAX];
vector<int> PI[NMAX];

void dijkstra(int n, int a, int b){
	priority_queue<pair<int, int> > PQ;
    int d[NMAX];
    bool vis[NMAX];
    for ( int i = 0; i < n; i++ ){
    d[i] = INFTY;
    vis[i] = false;
    PI[i].clear();
  }
  d[a] = 0;
  PQ.push(make_pair(0, a));

  pair<int, int> cur;
  int u, v, w, nw;
  while(!PQ.empty()){
    cur = PQ.top(); PQ.pop();
  u= cur.second;
    w = cur.first*(-1);
    vis[u] = true;
    for ( int i = 0; i < G[u].size(); i++ ){
      v = G[u][i].first;
      nw = G[u][i].second;
      if ( vis[v] ) continue;
      if ( d[v] == d[u] + nw ){
    PI[v].push_back(u);
      } else if ( d[v] > d[u] + nw ){
    PI[v].clear();
    PI[v].push_back(u);
    d[v] = d[u] + nw;
    PQ.push(make_pair((-1)*d[v], v));
      }
    }
  }
}

void makeDag(int n, int u){
  bool vis[NMAX];
  for ( int i = 0; i < n; i++ ) {
    DAG[i].clear();
    vis[i] = false;
  }
  stack<int> st; st.push(u);
  vis[u] = true;
  while(!st.empty()){
    u = st.top(); st.pop();
    for ( int i = 0; i < PI[u].size(); i++ ) DAG[PI[u][i]].push_back(u);
    for ( int i = 0; i < PI[u].size(); i++ ){
      int v = PI[u][i];
      if ( !vis[v] ){
    vis[v] = true;
    st.push(v);
      }
    }
  }
}

void tsort(int n, int s, int order[NMAX]){
  int indeg[NMAX];
  for ( int i = 0; i < n; i++ ) {
    indeg[i] = 0;
    order[i] = INFTY;
  }

  for ( int u = 0; u < n; u++ ){
    for ( int i = 0; i < DAG[u].size(); i++ ){
      int v = DAG[u][i];
      indeg[v]++;
    }
  }

  int pos = 0;
  queue<int> q;
  q.push(s);
  for (; !q.empty(); ){
    int u = q.front(); q.pop();
    order[u] = pos;
    pos++;
    for ( int i = 0; i < DAG[u].size(); i++ ){
      int v = DAG[u][i];
      indeg[v]--;
      if ( indeg[v] == 0 ){
    q.push(v);
      }
    }
  }
}

void valid(int n, int nedge, int sources[], int targets[], int bit, int qs[], int qt[], bool ans[]){
  static ull dp[NMAX];
  for ( int i = 0; i < n; i++ ) dp[i] = 0;
  for ( int i = 0; i < bit; i++ ){
    dp[qs[i]] |= ( 1ULL << i);
  }

  for ( int i = 0; i < nedge; i++ ){
    dp[targets[i]] |= dp[sources[i]];
  }

  for ( int i = 0; i < bit; i++ ){
    ans[i] = dp[qt[i]] & ( 1ULL << i);
  }
}

int main(){
  int n, e, q, a, b, u, v, w;
  scanf("%d %d", &n, &e);
  for ( int i = 0; i < e; i++ ){
    scanf("%d %d %d", &u, &v, &w);
    u--, v--;
    G[u].push_back(make_pair(v, w));
    G[v].push_back(make_pair(u, w));
  }
  scanf("%d %d %d", &a, &b, &q);
  a--; b--;

  dijkstra(n, a, b);

  makeDag(n, b);

  int order[NMAX];

  tsort(n, a, order);

  vector<pair<int, int> > torder_with_index(n);
  for ( int i = 0; i < n; i++ ) torder_with_index[i] = make_pair(order[i], i);
  sort( torder_with_index.begin(), torder_with_index.end());
  static int sources[EMAX];
  static int targets[EMAX];
  int nedge = 0;
  for ( int i = 0; i < n; i++ ){
    if ( torder_with_index[i].first == INFTY ) break;
    u = torder_with_index[i].second;
    for ( int j = 0; j < DAG[u].size(); j++ ){
      v = DAG[u][j];
      sources[nedge] = u;
      targets[nedge] = v;
      nedge++;
    }
  }

  static int qs[NMAX], qt[NMAX];
  static bool ans[NMAX];
  for(int nquery = 0; nquery < q;){
    int bit;
    for ( bit = 0; bit < LIM && nquery < q; bit++, nquery++ ){
      scanf("%d %d", &qs[bit], &qt[bit]);
      qs[bit]--; qt[bit]--;
    }
    valid(n, nedge, sources, targets, bit, qs, qt, ans);
    for ( int i = 0; i < bit; i++ ){
      if ( ans[i] ) printf("Yes\n");
      else printf("No\n");
    }
  }
  return 0;
}

Measured memory_bytes: 25792