// TaskB.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <map>

using namespace std;

using ll = long long;
using ld = long double;

const int inf = 1e9 + 7;
const int mod = 1e9 + 7;

int t;
int n, m;
vector<int> a;
vector<int> ar;

int cnt0(int p, int d) {
	if (p == m - 1 && d == 0) {
		return 0;
	}
	if (d == 1) {
		return m - p - 1;
	}
	return p * 2 + m - p - 1;
}

int mx = 0;
int xt = 0;
int curt = 0;

void xmove(int &p, int &d, int &cnt) {
	if (p == 0) {
		d = 1;
	}
	if (p == m - 1) {
		d = 0;
	}
	if (d == 0) {
		if (cnt <= p) {
			p -= cnt;
		}
		else {
			cnt -= p;
			p = 0;
			xmove(p, d, cnt);
		}
	}
	else {
		if (cnt <= m - p - 1) {
			p += cnt;
		}
		else {
			cnt -= m - p - 1;
			p = m - 1;
			xmove(p, d, cnt);
		}
	}
	if (p == 0) {
		d = 1;
	}
	if (p == m - 1) {
		d = 0;
	}
}

void move(int cnt) {
	curt += cnt;
	cnt %= (m * 2 - 2);
	for (int i = 0; i < n; i++) {
		int ncnt = cnt;
		xmove(a[i], ar[i], ncnt);
	}
}

int getcnt(int p1, int d1, int p2, int d2) {
	if (p1 > p2) {
		swap(p1, p2);
		swap(d1, d2);
	}
	if (p1 == p2) {
		return 0;
	}
	int ans = 0;
	if (d1 == 0) {
		int cnt = p1;
		ans += cnt;
		xmove(p1, d1, cnt);
		xmove(p2, d2, cnt);
	}
	if (d2 == 1) {
		int cnt = m - p2;
		ans += cnt;
		xmove(p1, d1, cnt);
		xmove(p2, d2, cnt);
	}
	ans += (p2 - p1) / 2;
	return ans;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin >> t;
	cin >> n >> m;
	a.resize(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		a[i]--;
	}
	string s;
	cin >> s;
	ar.resize(n);
	for (int i = 0; i < n; i++) {
		ar[i] = (s[i] == 'R');
	}
	vector<pair<int, int>> xd(n);
	int val0 = cnt0(a[0], ar[0]) % 2;
	for (int i = 0; i < n; i++) {
		if (cnt0(a[i], ar[i]) % 2 != val0) {
			cout << "No" << '\n';
			return 0;
		}
		xd[i] = { cnt0(a[i], ar[i]), i };
	}
	cout << "Yes" << '\n';
	sort(xd.begin(), xd.end());
	int last = m - 1;
	move(xd[0].first);
	vector<pair<int, int>> ans;
	for (int i = 0; i < n - 1; i++) {
		int ind = xd[i + 1].second;
		int cnt = getcnt(last, 0, a[ind], ar[ind]);
		if (cnt == 0) {
			continue;
		}
		int p = last;
		int xd = 0;
		xmove(p, xd, cnt);
		if (p < m / 2) {
			p = m - p - 1;
			cnt += m - 1;
		}
		move(cnt);
		ans.push_back({ curt, p + 1 });
		m = p + 1;
		last = m - 1;
	}
	if (t >= 2) {
		cout << m << '\n';
	}
	if (t >= 3) {
		cout << ans.size() << '\n';
		for (pair<int, int> par : ans) {
			cout << par.first << ' ' << par.second << '\n';
		}
	}
}
