#include #include #include #include using namespace std; struct Tnode { bool czy=0; bool jak=0; }; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n,m,r,t1,t2; cin>>n>>m>>r>>t1>>t2; Tnode **tab=new Tnode*[n+r]; for(int i=0;i>a>>b>>c; tab[a][b].czy=1; tab[b][a].czy=1; if(c=='Q') { tab[a][b].jak=1; tab[b][a].jak=1; } } for(int k=0;k>a>>b; for(int i=0;iq; q.push(0); queuew; w.push(0); int q1,w1; while(q.size()>0) { q1=q.front(); w1=w.front(); q.pop(); w.pop(); tab1[q1]=w1; for(int i=1;i