SEMPR = = The best problem Solver?
Time limit:2000/1000 MS (java/others) Memory limit:65535/32768 K (java/others)
Total submission (s): 1490 Accepted Submission (s): 970
Problem Descriptionas is known to all, Sempr (liangjing Wang) had solved more than 1400 problems on POJ, but nobody know th E days and nights he had spent on solving problems.
Xiangsanzi (Chen Zhou) was a perfect problem solver too. Now the is a stories about them happened and years ago.
On March 2006, SEMPR & Xiangsanzi were new comers of HUSTACM team and both of them want to being "the best new comers of March ", so they spent days and nights solving problems on POJ.
Now the problem is below:both of them be perfect problem solvers and they had the same speed, that's to say SEMPR can S Olve the same amount of problems as Xiangsanzi, but SEMPR enjoyed submitting all the problems at the end of every A hours But Xiangsanzi enjoyed submitting them at the end of every B hours. In these days, static (Xiaojun Wu) was the assistant coach of HUSTACM, and he would check the number of problems they solve D at Time T. Give you three integers a,b,and T, you should tell me who's "the best New comers of March". If they solved the same amount of problems, output "both!". If SEMPR or Xiangsanzi submitted at time T, static would wait them.
Inputin the first line there are an integer N, which means the number of cases in the data file, followed by N lines.
For each line, there is 3 integers:a, B, T.
Be sure, that a, B and N are no more than 10000 and T is no more than 100000000.
Outputfor each case of the input, you should output the answer for one line. If Sempr won, output "sempr!". If Xiangsanzi won, output "xiangsanzi!". And if both of them won, output "both!".
Sample Input32 3 42 3 62 3 9
Sample outputsempr! both! xiangsanzi!
Hdoj 1898 Sempr = = The best problem Solver?