fork download
  1. #include<bits/stdc++.h>
  2. const int M=2e5;
  3. using namespace std;
  4. vector<int>v[M];
  5. int d[M];
  6. void dfs(int u,int p,int c)
  7. {
  8. d[u]=c;
  9. for(auto &to:v[u])
  10. {
  11. if(to!=p)
  12. {
  13. dfs(to,u,1-c);
  14. }
  15. }
  16. }
  17. int main() {
  18. int n;
  19. cin>>n;
  20. for(int i=0;i<n-1;i++)
  21. {
  22. int x,y;
  23. cin>>x>>y;
  24. v[x].push_back(y);
  25. v[y].push_back(x);
  26. }
  27. dfs(1,-1,0);
  28. int q;
  29. cin>>q;
  30. while(q--)
  31. {
  32. int x,y;
  33. cin>>x>>y;
  34. if(d[x]^d[y])
  35. cout<<"Odd"<<endl;
  36. else
  37. cout<<"Even"<<endl;
  38. }
  39. return 0;
  40. }
Runtime error #stdin #stdout 0s 20696KB
stdin
Standard input is empty
stdout
Standard output is empty