#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <ctime>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <functional>
#include <fstream>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <numeric>
#include <cassert>
using namespace std;


struct NODE{
	int from,to,cost;
	NODE(int to,int cost) : to(to) , cost(cost) {};
	NODE(int from,int to,int cost) : from(from) , to(to) , cost(cost) {};
	NODE(){}
};
bool operator < (const NODE &a,const NODE &b){
	return a.cost > b.cost;
}

vector<NODE> graph[100000];
vector<NODE> dag[100000];
vector<NODE> rdag[100000];


int qc[40000],qd[40000];

int cost[100000] = {};

long long dp[100000] = {};


int a_to_c_can[100000] = {};
int b_to_d_can[100000] = {};
int cost2[100000] = {};

void acdfs(int x){
	if( !a_to_c_can[x] ){
		a_to_c_can[x] = 1;
	}else return;
	for(int i = 0 ; i < dag[x].size() ; i++)
		acdfs(dag[x][i].to);
}
void bddfs(int x){
	if( !b_to_d_can[x] ){
		b_to_d_can[x] = 1;
	}else return;
	for(int i = 0 ; i < rdag[x].size() ; i++)
		bddfs(rdag[x][i].to);
}
int main(){
	
	memset(cost,-1,sizeof(cost));
	int S,R;
	scanf("%d%d",&S,&R);
	
	for(int i = 0 ; i < R ; i++){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		u--,v--;
		graph[u].push_back(NODE(u,v,w));
		graph[v].push_back(NODE(v,u,w));
	}
	int a,b,qu;
	scanf("%d%d%d",&a,&b,&qu);
	for(int i = 0 ; i < qu ; i++){
		scanf("%d%d",&qc[i],&qd[i]);
		qc[i]--,qd[i]--;
	}
	a--,b--;
	priority_queue<NODE> Q;
	Q.push(NODE(a,0));
	while(Q.size()){
		NODE q = Q.top(); Q.pop();
		if( cost[q.to] == -1 ){
			cost[q.to] = q.cost;
		}else continue;
		for(int i = 0 ; i < graph[q.to].size() ; i++)
			Q.push(NODE(graph[q.to][i].to,q.cost+graph[q.to][i].cost));
	}
	for(int i = 0 ; i < S ; i++){
		for(int j = 0 ; j < graph[i].size() ; j++){
			if( cost[i] + graph[i][j].cost == cost[graph[i][j].to] ){
				dag[i].push_back(NODE(i,graph[i][j].to,1));
				rdag[graph[i][j].to].push_back(NODE(graph[i][j].to,i,1));
			}
		}
	}
	acdfs(a);
	bddfs(b);
	/*
	for(int i = 0 ; i < S ; i++)
		cout << a_to_c_can[i] << " ";
	cout << endl;
	for(int i = 0 ; i < S ; i++)
		cout << b_to_d_can[i] << " ";
	cout << endl;
	for(int i = 0 ; i < S ; i++)
		cout << cost[i] << " ";
	cout << endl;
	*/
	/*for(int i = 0 ; i < S ; i++){
		for(int j = 0 ; j < dag[i].size() ; j++) cout << "(" << i << "," << dag[i][j].to << ")" << " ";
		cout << endl;
	}
	*/
	// 最短経路dagのトポロジカルソートは、重みでソートするだけで良い
	vector< pair<int,int> > tpr_sort;
	for(int i = 0 ; i < S ; i++) tpr_sort.push_back(make_pair(cost[i],i));
	sort(tpr_sort.begin(),tpr_sort.end());
	int sz = 60;
	for( int d = 0 ; d < qu ; d += sz ){
		memset(dp,0,sizeof(dp));
		int x = d , y = min(qu,d+sz);
		for(int i = x ; i < y ; i++){
			dp[qc[i]] |= (1ll<<(i-x));
		}
		for(int i_ = 0 ; i_ < S ; i_++){
			int i = tpr_sort[i_].second;
			for(int j = 0 ; j < dag[i].size() ; j++)
				dp[dag[i][j].to] |= dp[i];
		}
		for(int i = x ; i < y ; i++){
			if( (dp[qd[i]]>>(i-x)&1) && a_to_c_can[qc[i]] && b_to_d_can[qd[i]] ){
				cout << "Yes" << endl;
			}else{
				cout << "No" << endl;
			}
		}
	}
	
}

Measured memory_bytes: 31084