#include <bits/stdc++.h>
using namespace std;
int n, s, q, e;
int const N = 100005;
vector<pair<int, int>> g[N];
vector <int> et;
pair<int, int> eti[N];
//vector<int> shops;
pair<int, int> roads[N];
void fet(int u, int p)
{
et.push_back(u);
eti[u]={et.size()-1, 0};
for(auto i: g[u])
{
if(i.first == p)continue;
fet(i.first, u);
}
et.push_back(u);
eti[u]={eti[u].first, et.size()-1};
}
set<pair<long long, int>> diss[N];
void dis(int sak, int u, int p, long long di=0)
{
diss[u].insert(make_pair(di, sak));
for(auto i: g[u])
{
if(i.first == p)continue;
dis(sak, i.first, u, di+i.second);
}
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> s >> q >> e;
for(int i = 0; i < n-1; i++)
{
int a, b, w; cin >> a >> b >> w;
g[a].push_back({b, w});
g[b].push_back({a, w});
roads[i+1]={a, b};
}
for(int i =0; i < s; i++)
{
int x; cin >> x;
//shops.push_back(x);
if(s!=n)dis(x, x, 0);
}
fet(e, 0);
while(q--)
{
int i, r; cin >> i >> r;
if(eti[roads[i].first].first <= eti[r].first && eti[roads[i].second].first <= eti[r].first && eti[roads[i].first].second >= eti[r].second && eti[roads[i].second].second >= eti[r].second)
{
if(s==n)
{
cout << "0\n"; continue;
}
long long rez=-1;
for(auto kk: diss[r])
{
int k = kk.second;
if(eti[roads[i].first].first <= eti[k].first && eti[roads[i].second].first <= eti[k].first && eti[roads[i].first].second >= eti[k].second && eti[roads[i].second].second >= eti[k].second)
{
rez=0;
cout << kk.first << "\n";
break;
}
}
if(rez==-1)
cout << "oo\n";
}
else
{
cout << "escaped\n";
}
}
return 0;
}