#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
#include <cstring>
#include <functional>
using namespace std;
typedef pair<int,int> P;
typedef unsigned long long int ull;
#define pb push_back
#define INF 1000000000
#define fi first
#define sec second
int dist1[100100],dist2[100100];
int c[40100],d[40100];
ull dp[100100];
struct edge
{
	int to,cost;
	edge(int to,int cost):to(to),cost(cost){}
};
vector<edge> g[100100];
int comp(int x,int y)
{
	return dist1[x]<dist1[y];
}
void dijkstra(int s,int t)
{
	for(int i=0;i<100100;i++)dist1[i]=INF,dist2[i]=INF;
	dist1[s]=0,dist2[t]=0;
	priority_queue<P,vector<P>,greater<P> >q;
	q.push(P(0,s));
	while(!q.empty())
	{
		P a = q.top();
		q.pop();
		int v = a.sec;
		for(int i=0;i<g[v].size();i++)
		{
			edge e = g[v][i];
			if(dist1[e.to]>dist1[v]+e.cost)
			{
				dist1[e.to] = dist1[v]+e.cost;
				q.push(P(dist1[e.to],e.to));
			}
		}
	}
	q.push(P(0,t));
	while(!q.empty())
	{
		P a = q.top();
		q.pop();
		int v = a.sec;
		for(int i=0;i<g[v].size();i++)
		{
			edge e = g[v][i];
			if(dist2[e.to]>dist2[v]+e.cost)
			{
				dist2[e.to] = dist2[v]+e.cost;
				q.push(P(dist2[e.to],e.to));
			}
		}
	}
	return;
}
int S,R,Q;
int a,b;
int main()
{
	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--;
		g[u].pb(edge(v,w));
		g[v].pb(edge(u,w));
	}
	scanf("%d %d %d",&a,&b,&Q);
	a--;b--;
	dijkstra(a,b);
	/*for(int i=0;i<S;i++)
	{
		cout << dist1[i] << ' ' << dist2[i] << endl;
	}*/
	vector<int> tp;
	for(int i=0;i<S;i++)tp.pb(i);
	sort(tp.begin(),tp.end(),comp);
	//for(int i=0;i<S;i++)cout << tp[i] << ' ';
	for(int i=0;i<Q;i+=60)
	{
		memset(dp,0,sizeof(dp));
		for(int j=0;j<min(60,Q-i);j++)
		{
			cin >> c[j] >> d[j];
			c[j]--;d[j]--;
			dp[c[j]]|=(1ull<<j);
		} 
		for(int j=0;j<S;j++)
		{
			int f = tp[j];
			if(dist1[f]+dist2[f]!=dist1[b])continue;
			for(int k=0;k<g[f].size();k++)
			{
				edge e = g[f][k];
				if(dist1[e.to]+dist2[e.to]!=dist1[b])continue;
				if(dist1[e.to]!=dist1[f]+e.cost)continue;
				dp[e.to]|=dp[f];
			}
		}
		for(int j=0;j<min(60,Q-i);j++)
		{
			if(dp[d[j]]&(1ull<<j))cout << "Yes" << endl;
			else cout << "No" << endl;
		}
	}
	return 0;
}