fork(1) download
  1. a=int(raw_input())
  2.  
  3. for i in range(a):
  4. b=int(raw_input())
  5. str1=[]
  6. for j in range(b):
  7. str1.append(raw_input())
  8.  
  9. str11=[]
  10. for j in str1:
  11. str11.append(j.split('on'))
  12.  
  13. str111=str11[::-1]
  14. print "Begin on" + str111[0][1]
  15. for j in range(len(str111)-1):
  16. print ("Right" if ("Left" in str111[j][0]) else "Left") + " on" + str111[j+1][1]
  17.  
Runtime error #stdin #stdout 0.08s 10864KB
stdin
Standard input is empty
stdout
Standard output is empty