// Arup Guha
// 3/16/2017
// Solution to 2017 UCF HS Contest Problem: Jumping Fish
// You can speed this up with StringBuffer and one output statement.

import java.util.*;

public class jump {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		// Process each case.
		for (int loop=1; loop<=numCases; loop++) {

			// Basic input.
			int x = stdin.nextInt();
			int y = stdin.nextInt();
			int n = stdin.nextInt();

			// Just keep track of the rectangle all the fish are in.
			int minX = 0, maxX = x-1, minY = 0, maxY = y-1;

			// Case Header.
			System.out.println("Trip #"+loop+":");

			// Process each move.
			for (int i=0; i<n; i++) {

				// Get this move.
				char dir = stdin.next().charAt(0);

				// Roughly, we can't fall off any edge, so just adjust each setting accordingly.
				if (dir == 'F') {
					minY = Math.max(0, minY-1);
					maxY = Math.max(0, maxY-1);
				}
				if (dir == 'B') {
					minY = Math.min(y-1, minY+1);
					maxY = Math.min(y-1, maxY+1);
				}
				if (dir == 'L') {
					minX = Math.max(0, minX-1);
					maxX = Math.max(0, maxX-1);
				}
				if (dir == 'R') {
					minX = Math.min(x-1, minX+1);
					maxX = Math.min(x-1, maxX+1);
				}

				// Just output the size of this rectangular area.
				System.out.println((maxX-minX+1)*(maxY-minY+1));
			}

			// After each case.
			System.out.println();
		}
	}
}