// Arup Guha
// 7/16/2025
// Solution to UCF 1995 HS Contest Problem: M&M Factory

import java.util.*;

public class factory {

	final public static String CHARS = "M3WE ";
	
	public static void main(String[] args) {
			
		// Not sure why they just didn't do this for all of the problems :(
		Scanner stdin = new Scanner(System.in);
		int nC = stdin.nextInt();

		// Process cases.
		for (int loop=0; loop<nC; loop++) {
		
			// This is the default state of all the characters.
			// 0 = M, 1 = 3, 2 = W, 3 = E, 4 = space.
			int n = stdin.nextInt();
			int[] state = new int[n];
			
			// Process moves.
			int numOp = stdin.nextInt();
			for (int z=0; z<numOp; z++) {
			
				// Read the move.
				char op = stdin.next().charAt(0);
				int pos = stdin.nextInt()-1;
				
				// Eating is easy =)
				if (op == 'E')
					state[pos] = 4;
				
				// Rotation
				else {
				
					// Do the rotations to the right.
					for (int i=pos,j=0; i<n; i++,j++) {
					
						// No gear to turn.
						if (state[i] == 4) break;
						
						// Clockwise.
						if (j%2 == 0) 
							state[i] = (state[i]+1)%4;
						
						// Counter-clockwise.
						else
							state[i] = (state[i]+3)%4;
					}
					
					// Not sure if this is in the input but just wanted to be safe.
					if (state[pos] != 4) {
					
						// Do rotations to the left. Start j at 1 since we're doing pos-1...
						for (int i=pos-1,j=1; i>=0; i--,j++) {
						
							// No gear to turn.
							if (state[i] == 4) break;
							
							// Clockwise.
							if (j%2 == 0)
								state[i] = (state[i]+1)%4;
							
							// Counter.
							else
								state[i] = (state[i]+3)%4;
						}
					}
				}
			}
			
			// Print out the letters.
			for (int i=0; i<n; i++)
				System.out.print(CHARS.charAt(state[i]));
			System.out.println();
		}
	}
}