Problem: We have decided to introduce an automatic ticket gate to the railway network of a certain country. One of the difficult issues to implement is determining whether a given ticket can move between designated stations. Each ticket has a boarding station and a getting-off station. With this ticket, you can not only "get on at the boarding station and get off at the getting off station", but you are also allowed to get on and off the train.

There are S stations on this rail network, of which Group R stations are adjacent and can be traversed in both directions without going through other stations. There is only one railroad track connecting adjacent stations. The distance between adjacent stations is the distance measured along this railroad track. There are multiple possible routes from one station to another, depending on the shape of the railway network, but the route with the shortest distance is called the shortest route. If there are multiple such routes, both are accepted as the shortest route.

You can move from station c to station d with a ticket for boarding station a and getting off station b if there is a route p that meets all of the following conditions.

* Route p is the shortest route from station a to station b.
* Route p is a route that starts from station a, goes through station c, then station d, and ends at station b. The section from station c to station d is the shortest route between these two stations.



You will be given route map and ticket information. Next, you will be given several pairs of start and end points, so write a program that determines whether you can move from the start point to the end point with that ticket.



input

The input consists of one dataset. Input data is given in the following format.


S R
u1 v1 w1
u2 v2 w2
::
uR vR wR
a b Q
c1 d1
::
cQ dQ


The numbers given on each line are separated by a single space.

The first line consists of two integers. S (2 ≤ S ≤ 100000) is the number of stations that appear on the railroad map, and R (1 ≤ R ≤ 200000) is the number of pairs of adjacent stations. The following R line is given information on the railroad tracks that directly connect adjacent stations. ui and vi (1 ≤ ui, vi ≤ S) indicate the station numbers at both ends of the i-th line. wi (1 ≤ wi ≤ 1000) is an integer representing the distance between these stations. However, numbers from 1 to S are assigned to each station without duplication, and ui ≠ vi.

The next line consists of three integers. The first two integers represent the ticket sections, where a is the boarding station and b is the getting-off station (1 ≤ a, b ≤ S). The third integer Q (1 ≤ Q ≤ 40000) indicates the number of questions. The question is given on the following Q line. ci and di (1 ≤ ci, di ≤ S) indicate the boarding and alighting stations of the i-th question. However, a ≠ b and ci ≠ di.

output

For each question, print Yes if you can move with the given ticket, or No if you can't.

Example

Input

6 7
1 2 3
1 4 1
2 3 5
4 3 1
3 6 2
4 5 2
5 6 1
1 6 6
1 6
4 3
4 6
5 6
2 6
2 5


Output

Yes
Yes
Yes
Yes
No
No

Solution (in CPP):

Solution:
#include<stdio.h>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
typedef unsigned long long wolf;
vector<pair<int,int> > g[110000];
vector<int> G[110000];
int ijk[110000];
int ijk2[110000];
int v[110000];
int x[41000];
int y[41000];
wolf L[110000];
wolf R[110000];
wolf tmp[110000];
pair<int ,int> r[110000];
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<b;i++){
		int p,q,r;scanf("%d%d%d",&p,&q,&r);
		p--;q--;
		g[p].push_back(make_pair(q,r));
		g[q].push_back(make_pair(p,r));
	}
	int c,d,e;
	scanf("%d%d%d",&c,&d,&e);
	c--;d--;
	for(int i=0;i<e;i++){
		scanf("%d%d",x+i,y+i);
		x[i]--;y[i]--;
	//	L[x[i]].push_back(i);
	//	R[x[i]].push_back(i);
	}
	priority_queue<pair<int,int> >Q;
	Q.push(make_pair(0,c));
	for(int i=0;i<a;i++)ijk[i]=ijk2[i]=999999999;
	ijk[c]=0;
	ijk2[d]=0;
	while(Q.size()){
		int cost=-Q.top().first;
		int at=Q.top().second;
		Q.pop();
		if(v[at])continue;
		v[at]=1;
		for(int i=0;i<g[at].size();i++){
			if(!v[g[at][i].first]&&ijk[g[at][i].first]>cost+g[at][i].second){
				ijk[g[at][i].first]=cost+g[at][i].second;
				Q.push(make_pair(-ijk[g[at][i].first],g[at][i].first));
			}
		}
	}
	for(int i=0;i<a;i++)v[i]=0;
	Q.push(make_pair(0,d));
	while(Q.size()){
		int cost=-Q.top().first;
		int at=Q.top().second;
		Q.pop();
		if(v[at])continue;
		v[at]=1;
		for(int i=0;i<g[at].size();i++){
			if(!v[g[at][i].first]&&ijk2[g[at][i].first]>cost+g[at][i].second){
				ijk2[g[at][i].first]=cost+g[at][i].second;
				Q.push(make_pair(-ijk2[g[at][i].first],g[at][i].first));
			}
		}
	}
	for(int i=0;i<a;i++){
		for(int j=0;j<g[i].size();j++)if(ijk[i]+g[i][j].second+ijk2[g[i][j].first]==ijk[d]){
			G[i].push_back(g[i][j].first);
		//	printf("%d %d\n",i,g[i][j].first);
		}
	}
	for(int i=0;i<a;i++)r[i]=make_pair(ijk[i],i);
	std::sort(r,r+a);
	for(int i=0;i<(e+63)/64;i++){
		queue<pair<int,wolf> > Q2;
		for(int j=i*64;j<min(i*64+64,e);j++){
			L[x[j]]+=(1LL<<(j%64));
			R[y[j]]+=(1LL<<(j%64));
		}
		for(int j=0;j<a;j++)tmp[j]=0LL;
		wolf ans=0LL;
		for(int j=0;j<a;j++){
			int at=r[j].second;
			tmp[at]|=L[at];
			ans|=(tmp[at]&R[at]);
			for(int k=0;k<G[at].size();k++){
				tmp[G[at][k]]|=tmp[at];
			}
		}
		for(int j=0;j<min(64,e-i*64);j++){
			if(ans&(1LL<<j))printf("Yes\n");
			else printf("No\n");
		}
		for(int j=i*64;j<min(i*64+64,e);j++){
			L[x[j]]-=(1LL<<(j%64));
			R[y[j]]-=(1LL<<(j%64));
		}
	}
}