fork download
  1. #include<iostream>
  2. #include<string>
  3. using namespace std;
  4. int main(){
  5. int T;
  6. cin>>T;
  7. while(T--){
  8. string p1,p2,choice1,choice2;
  9. long long x,y;
  10. cin>>p1>>choice1>>p2>>choice2>>x>>y;
  11. if((x+y)%2==0)
  12. if(choice1[0]='P')
  13. cout<<p1<<endl;
  14. else cout<<p2<<endl;
  15. else if(choice1[0]='P')
  16. cout<<p2<<endl;
  17. else cout<<p1<<endl;
  18. }
  19. return 0;
  20. }
Success #stdin #stdout 0s 15240KB
stdin
4
Quico PAR Chiquinha IMPAR
9 7
Dami PAR Marcus IMPAR
12 3
Dayran PAR Conrado IMPAR
3 1000000000
Popis PAR Chaves IMPAR
2 7
stdout
Quico
Marcus
Conrado
Chaves