#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

template<class T>
ostream& operator<<(ostream& out, vector<T> v) {
	for (T it : v) {
		out << it << ' ';
	}
	out << '\n';
	return out;
}

#define ll long long

const int MAX = 200'005;
const int MOD = 998'244'353;

int a[MAX];
int n, m;
string s;

void pos(int i, int t) {
	t %= 2 * m - 1;
	t += 2 * m - 1;
	t %= 2 * m - 1;

	if (s[i] == 'L') {
		a[i] -= t;
		if (a[i] <= 0) {
			a[i] = 2 - a[i];
			s[i] = (s[i] == 'L') ? 'R' : 'L';
		}
	}
	else {
		a[i] += t;
	}
	if (a[i] > m) {
		a[i] = 2 * m - a[i];
		s[i] = (s[i] == 'L') ? 'R' : 'L';
	}
}
int main()
{
	int t;
	cin >> t;
	cin >> n >> m;

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	cin >> s;

	for (int i = 1; i < n; i++) {
		if (a[i - 1] % 2 != a[i] % 2) {
			cout << "No";
			return 0;
		}
	}

	cout << "Yes\n";

	if (n == 2) {
		int tm, ps = -1;
		for (int i = 0; i < 40 * m + 1; i++) {
			if (a[0] == a[1] && ps < a[0]) {
				ps = a[0];
				tm = i;
			}
			pos(0, 1);
			pos(1, 1);
		}
		if (t > 1) {
			cout << ps << '\n';
		}
		if (t == 3) {
			cout << 1 << '\n';
			cout << tm << ' ' << ps;
		}
		return 0;
		if (a[0] > a[1]) {
			swap(a[0], a[1]);
			swap(s[0], s[1]);
		}
		bool rev = false;
		if (s[1] == 'R') {
			s[1] = 'L';
			s[0] = (s[0] == 'L') ? 'R' : 'L';
			rev = true;
		}
		vector<pair<int, int>> res;
		if (s[0] == 'R') {
			res.push_back({ (a[1] - a[0]) / 2, (a[0] + a[1]) / 2 });
		}
		else {
			int x = 1;
			int y = a[1] - a[0] + 1;
			res.push_back({ a[0] - 1 + (y - x) / 2, (x + y) / 2 });
		}
		if (res[0].second < m + 1 - res[0].second) {
			res[0].first += m - 1;
			res[0].second = m + 1 - res[0].second;
		}
		if (rev) {
			res[0].first = 2 * m - 1 - res[0].first;
		}
		int mn = m;
		for (auto p : res) {
			mn = min(mn, p.second);
		}
		if (t > 1) {
			cout << mn << '\n';
		}
		if (t == 3) {
			cout << res.size() << '\n';
			for (auto p : res) {
				cout << p.first << ' ' << p.second << '\n';
			}
		}
		return 0;
	}
	int im = 0;
	for (int i = 0; i < n; i++) {
		if (a[im] < a[i] || (a[im] == a[i] && s[i] == 'R')) {
			im = i;
		}
	}
	int bg = 0;
	if (s[im] == 'R') {
		bg = n - a[im];
		for (int i = 0; i < n; i++) {
			pos(i, bg);
		}
		for (int i = 0; i < n; i++) {
			if (a[i] == 1) {
				s[i] = 'R';
			}
			else if (a[i] == m) {
				s[i] = 'L';
			}
		}
	}
	vector<pair<int, int>> res;
	for (int i = 0; i < n; i++) {
		if (a[i] != a[im]) {
			if (s[i] == 'R') {
				res.push_back({ bg + (a[im] - a[i]) / 2, (a[i] + a[im]) / 2 });
			}
			else {
				int x = 1;
				int y = a[im] - a[i] + 1;
				res.push_back({ bg + a[i] - 1 + (y - x) / 2, (x + y) / 2 });
			}
		}
	}
	int mn = m;
	for (auto p : res) {
		mn = min(mn, p.second);
	}
	if (t > 1) {
		cout << mn << '\n';
	}
	if (t == 3) {
		sort(res.begin(), res.end());
		res.resize(unique(res.begin(), res.end()) - res.begin());
		cout << res.size() << '\n';
		for (auto p : res) {
			cout << p.first << ' ' << p.second << '\n';
		}
	}
}


