#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<deque>
#include<iomanip>
#include<queue>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<bitset>
#include<cmath>
#include<algorithm>
#include<random>
#include<ctime>

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,avx2,bmi,popcnt")

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uint = unsigned int;

mt19937 mt(time(0));
const int N = 2e5 + 2, mod = 998244353, inf = 1e9 + 100;
const ll llinf = 1e18 + 1000;
int n, m, a[N], b[N], ty;
int get(int i, int go, int cnt) {
	cnt %= (m * 2 - 2);
	if (go == 0) {
		i = m + 1 - i;
	}
	if (i + cnt <= m) {
		i = i + cnt;
	}
	else {
		cnt -= (m - i);
		i = m;
		if (i - cnt >= 1) {
			i -= cnt;
		}
		else {
			cnt -= (m - 1);
			i = 1;
			i += cnt;
		}
	}
	if (go == 0) {
		i = m + 1 - i;
	}
	return i;
}
int get2(int i, int go, int cnt) {
	int ans = 1;
	cnt %= (m * 2 - 2);
	if (go == 0) {
		i = m + 1 - i;
	}
	if (i + cnt <= m) {
		i = i + cnt;
	}
	else {
		cnt -= (m - i);
		i = m;
		if (i - cnt >= 1) {
			i -= cnt;
			ans = 0;
		}
		else {
			cnt -= (m - 1);
			i = 1;
			i += cnt;
		}
	}
	if (go == 0) {
		i = m + 1 - i;
		ans ^= 1;
	}
	return ans;
}

void solve() {
	cin >> ty >> n >> m;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
	}
	for (int i = 0; i + 1 < n; ++i) {
		if (a[i] % 2 != a[i + 1] % 2) {
			cout << "No";
			return;
		}
	}
	string s;
	cin >> s;
	for (int i = 0; i < n; ++i) {
		b[i] = (s[i] == 'R') ? 1 : 0;
	}
	cout << "Yes\n";
	if (ty == 1) return;
	for (int i = 1; i < n; ++i) {
		for (int j = 0; j < i; ++j) {
			if (a[i] == a[j] && b[i] == b[j]) {
				swap(a[i], a[n - 1]);
				swap(b[i], b[n - 1]);
				--n, --i;
				break;
			}
		}
	}
	vector<pair<ll, int>> ans;
	ll add = 0;
	while (n > 1) {
		int mxt = -1, indt = -1;
		for (int t = 0; t < m * 2 - 2; ++t) {
			int mx = -1, ind = -1, cnt = 0;
			for (int i = 0; i < n; ++i) {
				int x = get(a[i], b[i], t);
				if (x > mx) {
					mx = x;
					ind = t;
					cnt = 1;
				}
				else if (x == mx) {
					++cnt;
				}
			}
			if (cnt == 2 && mx > mxt){
				mxt = mx;
				indt = t;
			}
		}
		ans.push_back({ add + indt, mxt });
		bool f = false;
		for (int i = 0; i < n; ++i) {
			int x = get(a[i], b[i], indt);
			int y = get2(a[i], b[i], indt);
			a[i] = x, b[i] = y;
			if (x == mxt && !f) {
				swap(a[i], a[n - 1]);
				swap(b[i], b[n - 1]);
				--n, --i;
				f = true;
			}
		}
		add += indt;
	}
	cout << m << '\n';
	if (ty == 2) return;
	cout << ans.size() << '\n';
	for (auto p : ans) cout << p.first << ' ' << p.second << '\n';
}

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int tt = 1;
	//cin >> tt;
	while (tt--) {
		solve();
		cout << '\n';
		cout.flush();
	}
	return 0;
}