#include <iostream>
#include <string>
#include <vector>
#include <cassert>

#include <string.h>
using namespace std;

class Track
{
	public:
		Track(int w, int h)
			: mWidth(w), mHeight(h)
		{
			mFields = new char[w*h];
		}

		~Track(void)
		{
			delete [] mFields;
		}

		char GetField(int x, int y) const
		{
			assert(x>=0 && x<mWidth);
			assert(y>=0 && y<mHeight);
			return mFields[y*mWidth+x];
		}

		friend istream & operator >> (istream &istr, Track &track)
		{
			for (int y = 0; y < track.mHeight; ++y)
				istr >> track.mFields + track.mWidth*y;
			return istr;
		}

		friend ostream & operator << (ostream &ostr, const Track &track)
		{
			int i = 0;
			for (int y = 0; y < track.mHeight; ++y)
			{
				for (int x = 0; x < track.mWidth; ++x)
					ostr << track.mFields[i++];
				ostr << endl;
			}
			return ostr;
		}

	private:
		int mWidth;
		int mHeight;
		char *mFields;
};

struct CrossingInfo
{
	int x;
	int y;
	int dir;
	int speed;
	int turn;
};

class Car
{
	public:
		void Simulate(const Track &track)
		{
			mCrashed = false;
			int n = strlen(mCommands);
			for (int i = 0; i < n; ++i)
			//for (unsigned int i = 0; i < mCommands.size(); ++i)
			{
				// execute command
				switch(mCommands[i])
				{
					case 'm':	// move on
						break;
					case 'a':	// accelerate
						if (mSpeed < mMaxSpeed)
							++mSpeed;
						break;
					case 'b':	// break
						if (mSpeed > 0)
							--mSpeed;
						break;
					case 'l':	// left
						mDir = (mDir>0) ? mDir-1 : 7;
						break;
					case 'r':	// right
						mDir = (mDir<7) ? mDir+1 : 0;
						break;
					default:
						cout<<"assert"<<endl;
						assert(false);
						break;
				}
				// move
				int ox, oy;
				switch (mDir)
				{
					case 0: ox= 0; oy=-1; break;
					case 1: ox= 1; oy=-1; break;
					case 2: ox= 1; oy= 0; break;
					case 3: ox= 1; oy= 1; break;
					case 4: ox= 0; oy= 1; break;
					case 5: ox=-1; oy= 1; break;
					case 6: ox=-1; oy= 0; break;
					case 7: ox=-1; oy=-1; break;
				}
				bool slowDown = false;
				for (int j = 0; j < mSpeed; ++j)
				{
					mX += ox;
					mY += oy;
					//cerr << "* " << mX << " " << mY << " " << mDir << " " << mSpeed << endl;
					switch (track.GetField(mX, mY))
					{
						case '.':
							slowDown = true;
							break;
						case 'x':
							break;
						case 'W':
							mCrashed = true;
							break;
						case 's':
						{
							CrossingInfo ci;
							ci.x = mX;
							ci.y = mY;
							ci.dir = mDir;
							ci.speed = mSpeed;
							ci.turn = i;
							mCrossings.push_back(ci);
							break;
						}
					}
					if (mCrashed)
						break;
				}
				if (mCrashed)
					break;
				if (slowDown && mSpeed>1)
					mSpeed = 1;
			}

			// print output
			cout << mX << " " << mY << " " << mDir << " " << mSpeed;
			if (mCrashed)
				cout << " crashed";
			cout << endl;
			for (unsigned int i = 0; i < mCrossings.size(); ++i)
			{
				cout << "crossing startline: "
					<< mCrossings[i].x << " " << mCrossings[i].y << " "
					<< mCrossings[i].dir << " " << mCrossings[i].speed << " "
					<< mCrossings[i].turn << endl;
			}
		}

		friend istream & operator >> (istream &istr, Car &car)
		{
			istr >> car.mX >> car.mY >> car.mDir >> car.mMaxSpeed;
			car.mSpeed = 0;
			memset(car.mCommands, 0, 11000);
			istr >> car.mCommands;
			return istr;
		}

		friend ostream & operator << (ostream &ostr, const Car &car)
		{
			ostr << car.mX << " " << car.mY << " " << car.mDir << " " << car.mMaxSpeed << endl;
			ostr << car.mCommands << endl;
			return ostr;
		}

	private:
		int mX;
		int mY;
		int mDir;
		int mSpeed;
		int mMaxSpeed;
		char mCommands[11000];

		vector<CrossingInfo> mCrossings;
		bool mCrashed;
};

int main(int argc, char **argv)
{
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
	{
		int w, h;
		cin >> w >> h;
		Track track(w, h);
		cin >> track;
		//cout << track;

		cout << "Scenario #" << i+1 << ":" << endl;
		int cars;
		cin >> cars;
		for (int j = 0; j < cars; ++j)
		{
			Car car;
			cin >> car;
	//		cout << car;
			car.Simulate(track);
		}
		cout << endl;
	}
	return 0;
}
