def analyze_choices(choices): n = len(choices) win_both = 0 lose_both = 0 tie_both = 0 # Iterate through the choices for i in range(n): # Compare with left neighbor left = choices[(i-1+n)%n] # Compare with right neighbor right = choices[(i+1)%n] # Check for tie if choices[i] == left and choices[i] == right: tie_both += 1 # Check for win elif (choices[i] == "R" and right == "S") or (choices[i] == "P" and right == "R") or (choices[i] == "S" and right == "P"): win_both += 1 # Check for lose elif (choices[i] == "R" and right == "P") or (choices[i] == "P" and right == "S") or (choices[i] == "S" and right == "R"): lose_both += 1 return win_both, lose_both, tie_both # Read number of test cases t = int(input()) # Process each test case for _ in range(t): # Read input for each test case n = int(input()) choices = input() # Analyze choices win, lose, tie = analyze_choices(choices) print(win, lose, tie)