编程介的小学生 2017-04-09 14:33 采纳率: 20.5%
浏览 781
已采纳

Kagome Kagome

Kagome Kagome is a Japanese children's game. One child is chosen as the oni (literally demon or ogre, but similar to the concept of "it" in tag) and sits blindfolded (or with their eyes covered). The other children join hands and walk in circles around the oni while singing the song for the game. When the song stops, the oni speaks aloud the name of the person behind him, and if he is correct, the person behind will exchange places with the oni.

Higurashi Tewi is playing Kagome Kagome with her n (n is even) friends as the oni now. She peeps to know who is right in front of her. Knowing the order of the children in circle and assuming that they keep distance evenly, it's easy to derive who is right behind her.

Input

There are multiple test cases. The first line of input is an integer T ≈ 100 indicating the number of test cases.

The first line of each test case starts with an even number 1 ≤ n ≤ 100, followed by the name of the child who is right in front of Higurashi Tewi. The second line contains exactly n different names, listed in counterclockwise order. Name is an alphanumeric string whose length never exceeds 20. It's guaranteed that the child in front of Higurashi Tewi is always contained in the list exactly once.

Output

For each test case, output the name of the child who is right behind Higurashi Tewi.

Sample Input

3
2 Alice
Alice Bob
4 inu
inu neko usagi kizune
4 cat
dog cat rabbit fox
Sample Output

Bob
usagi
fox

  • 写回答

1条回答 默认 最新

  • devmiao 2017-04-09 15:43
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 MapReduce实现倒排索引失败
  • ¥15 luckysheet
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码
  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题