#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;
const int sep = 64;
typedef unsigned long long ulint;
typedef pair<int, int> Pr;
typedef tuple<int, int, int> Tp;

int n, m, A, B, Q;
vector<vector<Pr>> g;
int qs[40000], qt[40000];

vector<vector<int>> mg;
vector<vector<int>> rmg;
vector<vector<int>> pre;
vector<vector<int>> rpre;
vector<int> tps, pos;
bool visit[100000];
ulint dp[100000];
bool ans[40000];

void dijkstra()
{
	mg = rmg = vector<vector<int>>(n);
	
	vector<int> dist(n, INF);
	dist[A] = 0;
	
	priority_queue<Pr, vector<Pr>, greater<Pr>> pq;
	pq.push(Pr(0, A));
	while (pq.size()){
		Pr p = pq.top(); pq.pop();
		int pos = p.second, sum = p.first;
		if (dist[pos] < sum) continue;
		
		for (auto &e : g[pos]){
			int to = e.first, cost = e.second;
			if (dist[to] > sum + cost){
				dist[to] = sum + cost;
				pq.push(Pr(sum + cost, to));
			}
		}
	}
	
	for (int v = 0; v < n; v++){
		for (auto &e : g[v]){
			int to = e.first, cost = e.second;
			if (dist[to] == dist[v] + cost){
				mg[v].push_back(to);
				rmg[to].push_back(v);
			}
		}
	}
}

void toposort(int v)
{
	visit[v] = true;
	
	for (int to : rmg[v]){
		if (!visit[to]) toposort(to);
	}
	
	pos[v] = tps.size();
	tps.push_back(v);
}

void doDp(int qs[], int qt[], bool ans[])
{
	fill_n(dp, 100000, 0);
	
	for (int i = 0; i < sep; i++){
		dp[pos[qs[i]]] |= 1ull << i;
	}
	
	for (int i = 0; i < tps.size(); i++){
		for (int to : mg[tps[i]]){
			if (pos[to] == -1) continue;
			//printf("%d -> %d\n", tps[i], to);
			dp[pos[to]] |= dp[i];
		}
	}
	
	for (int i = 0; i < sep; i++){
		if (pos[qt[i]] == -1) ans[i] = false;
		else {
			ans[i] = (dp[pos[qt[i]]] & (1ull << i)) ? true : false;
		}
	}
}

void solve()
{
	dijkstra();
	
	fill_n(visit, n, false);
	tps = vector<int>();
	pos = vector<int>(n, -1);
	toposort(B);
	
	for (int i = 0; i < Q; i += sep){
		doDp(qs + i, qt + i, ans + i);
	}
	
	for (int i = 0; i < Q; i++){
		puts(ans[i] ? "Yes" : "No");
	}
}

int main()
{
	scanf("%d %d", &n, &m);
	
	g = vector<vector<Pr>>(n);
	
	for (int i = 0; i < m; i++){
		int u, v, w;
		scanf("%d %d %d", &u, &v, &w);
		g[--u].push_back(Pr(--v, w));
		g[v].push_back(Pr(u, w));
	}
	scanf("%d %d %d", &A, &B, &Q);
	--A; --B;
	for (int i = 0; i < Q; i++){
		scanf("%d %d", &qs[i], &qt[i]);
		qs[i]--; qt[i]--;
	}
	
	solve();
}