#include <bits/stdc++.h>
//#include "highway.h"
using namespace std;
#define MAXN 90001
int N,M,S,T,A,B;
vector<int> U,V;
vector<pair<int,int>> graph[MAXN];
priority_queue<pair<long long,int>> pq;
long long dijk[MAXN];int cnt=0;bool found=false;
int n,m,a,b;
vector<pair<int,int>> adj[MAXN];
int dist[2][MAXN];pair<int,int> parent[2][MAXN];
vector<int> state;queue<int> bfsq;
vector<int> nodes[2][MAXN];
void dijkstra(int root)
{
for (int node=0;node<N;node++) dijk[node]=LLONG_MAX;
dijk[root]=0;pq.push({0,root});
while (!pq.empty())
{
long long depth=pq.top().first,node=pq.top().second;pq.pop();
if (dijk[node]!=depth) continue;
for (pair<int,int> edge:graph[node])
{
int sled=edge.first,cost=edge.second;
if (dijk[sled]>dijk[node]+cost)
{
dijk[sled]=dijk[node]+cost;
pq.push({dijk[sled],sled});
}
}
}
}
long long ask(vector<int> vec)
{
cnt++;
for (int i=0;i<M;i++)
{
if (vec[i]==0) {graph[U[i]].push_back({V[i],A});graph[V[i]].push_back({U[i],A});}
else {graph[U[i]].push_back({V[i],B});graph[V[i]].push_back({U[i],B});}
}
dijkstra(S);for (int node=0;node<N;node++) graph[node].clear();
return dijk[T];
}
void answer(int node1,int node2)
{
if (node1==S and node2==T) found=true;
if (node1==T and node2==S) found=true;
}
void bfs(int p,int root)
{
for (int node=0;node<n;node++) {dist[p][node]=INT_MAX;parent[p][node]={-1,-1};}
dist[p][root]=0;bfsq.push(root);
while (!bfsq.empty())
{
int node=bfsq.front();bfsq.pop();
for (pair<int,int> edge:adj[node])
{
if (dist[p][edge.first]!=INT_MAX) continue;
dist[p][edge.first]=dist[p][node]+1;
parent[p][edge.first]={node,edge.second};
bfsq.push(edge.first);
}
}
}
void find_pair(int N, std::vector<int> U, std::vector<int> V, int A, int B)
{
/// za debugovanje
n=N;m=(int)U.size();a=A;b=B;
for (int edge=0;edge<m;edge++) {adj[U[edge]].push_back({V[edge],edge});adj[V[edge]].push_back({U[edge],edge});}
for (int i=0;i<m;i++) state.push_back(0);
long long initial=ask(state);
int l=0,r=m-1,rez=-1;
while (l<=r)
{
int mid=(l+r)/2;
for (int pos=0;pos<=mid;pos++) state[pos]=1;
long long curr=ask(state);
if (curr==initial) l=mid+1;
else {rez=mid;r=mid-1;}
for (int pos=0;pos<=mid;pos++) state[pos]=0;
}
int index=rez;cout<<rez<<endl;
int root1=U[index],root2=V[index];
bfs(0,root1),bfs(1,root2);cout<<root1<<" "<<root2<<endl;
for (int i=0;i<m;i++) state[i]=1;
for (int node=0;node<n;node++)
{
if (dist[0][node]==dist[1][node]) continue;
if (dist[0][node]<dist[1][node])
{
nodes[0][dist[0][node]].push_back(node);
if (parent[0][node].first!=-1) state[parent[0][node].second]=0;
}
if (dist[1][node]<dist[0][node])
{
nodes[1][dist[1][node]].push_back(node);
if (parent[1][node].first!=-1) state[parent[1][node].second]=0;
}
}
state[index]=0;//cout<<state<<endl;
l=1,r=n,rez=0;
while (l<=r)
{
int mid=(l+r)/2;
for (int depth=mid;depth<=n;depth++)
{
for (int node:nodes[0][depth]) state[parent[0][node].second]=1;
}
long long curr=ask(state);
if (curr!=initial) {rez=mid;l=mid+1;}
else r=mid-1;
for (int depth=mid;depth<=n;depth++)
{
for (int node:nodes[0][depth]) state[parent[0][node].second]=0;
}
}
int depth0=rez;cout<<depth0<<endl;
l=1,r=n,rez=0;
while (l<=r)
{
int mid=(l+r)/2;
for (int depth=mid;depth<=n;depth++)
{
for (int node:nodes[1][depth]) state[parent[1][node].second]=1;
}
long long curr=ask(state);
if (curr!=initial) {rez=mid;l=mid+1;}
else r=mid-1;
for (int depth=mid;depth<=n;depth++)
{
for (int node:nodes[1][depth]) state[parent[1][node].second]=0;
}
}
int depth1=rez;cout<<depth1<<endl;
int node0=-1,node1=-1;
if (depth0==0) node0=nodes[0][0][0];
else
{
l=0,r=(int)nodes[0][depth0].size()-1,rez=-1;
while (l<=r)
{
int mid=(l+r)/2;
for (int pos=0;pos<=mid;pos++) state[parent[0][nodes[0][depth0][pos]].second]=1;
long long curr=ask(state);
if (curr!=initial) {rez=mid;r=mid-1;}
else l=mid+1;
for (int pos=0;pos<=mid;pos++) state[parent[0][nodes[0][depth0][pos]].second]=0;
}
node0=nodes[0][depth0][rez];
}
if (depth1==0) node1=nodes[1][0][0];
else
{
l=0,r=(int)nodes[1][depth1].size()-1,rez=-1;
while (l<=r)
{
int mid=(l+r)/2;
for (int pos=0;pos<=mid;pos++) state[parent[1][nodes[1][depth1][pos]].second]=1;
long long curr=ask(state);
if (curr!=initial) {rez=mid;r=mid-1;}
else l=mid+1;
for (int pos=0;pos<=mid;pos++) state[parent[1][nodes[1][depth1][pos]].second]=0;
}
node1=nodes[1][depth1][rez];
}
answer(node0,node1);return;
}
int main()
{
cin>>N>>M>>A>>B>>S>>T;
for (int i=1;i<=M;i++)
{
int u,v;cin>>u>>v;
U.push_back(u);V.push_back(v);
}
find_pair(N,U,V,A,B);
if (found) {cout<<"Accepted"<<endl;cout<<cnt<<endl;}
else cout<<"WA"<<endl;
}