#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <random>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;
using ll = long long;
using ld = long double;

const int inf = 1e9 + 10;

void add_time(int& pos, int& dir, int t, const int m) {
	t %= (m - 1) * 2;
	if (dir) {
		if (t > m - 1 - pos) {
			pos = m - 1 - (t - m + 1 + pos);
			dir = 0;
			return;
		}
		else {
			pos += t;
			return;
		}
	}
	else {
		if (t > pos) {
			pos = t - pos;
			dir = 1;
			return;
		}
		else {
			pos -= t;
			return;
		}
	}
}

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);

	int T, n, m;
	cin >> T >> n >> m;
	vector<int> a(n);
	vector<int> d(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i]--;
		if (i > 0 && a[i] % 2 != a[i - 1] % 2) {
			cout << "No";
			return 0;
		}
	}
	for (int i = 0; i < n; i++) {
		char c;
		cin >> c;
		d[i] = (c == 'R');
	}
	cout << "Yes\n";
	if (T == 1)
		return 0;

	int m0 = m;
	ll t = 0;
	vector<pair<ll, int>> ans;
	while (true) {
		int maxp = -1;
		int ati = 1;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (a[j] <= a[i])
					continue;
				const int x = a[i], y = a[j];
				if (d[i] && d[j]) {
					if (maxp < (x - y) / 2 + m - 1) {
						maxp = (x - y) / 2 + m - 1;
						ati = maxp - x;
					}
					if (maxp < (y - x) / 2) {
						maxp = (y - x) / 2;
						ati = (m - 1) * 2 - x - maxp;
					}
				}
				if (d[i] && d[j] == 0) {
					if (maxp < (x + y) / 2) {
						maxp = (x + y) / 2;
						ati = maxp - x;
					}
					if (maxp < m - 1 - (x + y) / 2) {
						maxp = m - 1 - (x + y) / 2;
						ati = (m - 1) * 2 - x - maxp;
					}
				}
				if (d[i] == 0 && d[j]) {
					if (maxp < m - 1 - (x + y) / 2) {
						maxp = m - 1 - (x + y) / 2;
						ati = maxp + x;
					}
					if (maxp < (x + y) / 2) {
						maxp = (x + y) / 2;
						ati = x - maxp + (m - 1) * 2;
					}
				}
				if (d[i] == 0 && d[j] == 0) {
					if (maxp < (y - x) / 2) {
						maxp = (y - x) / 2;
						ati = maxp + x;
					}
					if (maxp < m - 1 + (x - y) / 2) {
						maxp = m - 1 + (x - y) / 2;
						ati = x - maxp + (m - 1) * 2;
					}
				}
			}
		}
		maxp++;

		if (maxp >= m) {
			while (true)
				m++;
		}

		bool fl = 1;
		for (int i = 0; i < n; i++) {
			add_time(a[i], d[i], ati, m);
			if (i > 0 && a[i] != a[i - 1])
				fl = 0;
			if (a[i] > maxp) {
				cout << "No";
				return 0;
			}
		}
		t += ati;
		m = maxp;
		ans.push_back({ t, maxp });
		if (fl)
			break;
	}
	cout << m << '\n';
	if (T == 2)
		return 0;
	cout << ans.size() << '\n';
	for (auto p : ans)
		cout << p.first << ' ' << p.second << '\n';
}
