fork download
  1. def main():
  2. # Input : 1
  3. # d5
  4. # output:
  5. # a5 b5 c5 e5 f5 g5 h5 d1 d2 d3 d4 d6 d7 d8
  6. def solve():
  7. rook = input()
  8. for i in range(97,105):
  9. if rook[0] != chr(i):
  10. print(chr(i) + rook[1])
  11. for j in range(1, 9):
  12. if str(rook[1]) != str(j):
  13. print(rook[0] + str(j))
  14. T = int(input())
  15.  
  16. while T != 0:
  17. solve()
  18. T-=1
  19.  
  20. if __name__ == "__main__":
  21.  
  22. main()
  23.  
Success #stdin #stdout 0.04s 9904KB
stdin
1
d5
stdout
a5
b5
c5
e5
f5
g5
h5
d1
d2
d3
d4
d6
d7
d8