# Python solution to "Queue at '63 South" from 2025 CS@UCF Summer camp

test_count = int(input())

for _ in range(test_count):
    # Read the total number of updates to the queue
    update_count = int(input())

    # Keep track of the number of students in queue - starting at 0!
    student_count = 0

    # Avoid printing an extra space by only printing spaces behind later numbers
    started = False
    for _ in range(update_count):
        update = input()
        # If the first character of update is "E", we need to read the second half as an integer
        if(update[0] == 'E'):
            group_size = int(update.split()[1])
            # Add the new students to the total
            student_count += group_size
        else:
            # A student is leaving the queue
            student_count -= 1

        if(started):
            print(" ", end="")
        else:
            started = True
        print(student_count, end="")
    #Print the new-line character at the end of our output
    print()
