#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()
#define int long long

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;
struct st {
	int a, b;
	bool operator==(st c) {
		return a == c.a && b == c.b;
	}
};
int n, m, ty;
int getbeg(st a) {
	if (a.b == 1) {
		return m * 2 - 1 - a.a;
	}
	else {
		return a.a - 1;
	}
}
st get(st a, int cnt) {
	bool f = (a.b == 0);
	cnt %= (m * 2 - 2);
	if (f) {
		a.a = m + 1 - a.a;
		a.b ^= 1;
	}
	if (a.a + cnt <= m) {
		a.a = a.a + cnt;
	}
	else {
		cnt -= (m - a.a);
		a.a = m;
		if (a.a - cnt >= 1) {
			a.a -= cnt;
		}
		else {
			cnt -= (m - 1);
			a.a = 1;
			a.a += cnt;
		}
	}
	if (f) {
		a.a = m + 1 - a.a;
		a.b ^= 1;
	}
	return a;
}
pair<int, int> cross(st a, st b) {
	int v1 = getbeg(a);
	int v2 = getbeg(b);
	if (v1 > v2) swap(v1, v2);
	if (v2 - v1 > m - 1) {
		v2 -= m * 2 - 2;
		swap(v1, v2);
	}
	int mx = m - (v2 - v1) / 2;
	int t = v2 + mx - 1;
	if (t < 0) t += m * 2 - 2;
	else if (t >= m * 2 - 2) t -= m * 2 - 2;
	return { mx, t };
}
bool cmp(st a, st b) {
	return getbeg(a) < getbeg(b);
}
st a[N];

void solve() {
	cin >> ty >> n >> m;
	for (int i = 0; i < n; ++i) {
		cin >> a[i].a;
	}
	for (int i = 0; i + 1 < n; ++i) {
		if (a[i].a % 2 != a[i + 1].a % 2) {
			cout << "No";
			return;
		}
	}
	string s;
	cin >> s;
	for (int i = 0; i < n; ++i) {
		a[i].b = (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]) {
				swap(a[i], a[n - 1]);
				--n, --i;
				break;
			}
		}
	}
	vector<pair<ll, int>> ans;
	ll add = 0;
	while (n > 1) {
		sort(a, a + n, cmp);
		int mxt = -1, indt = -1;
		for (int t = 0; t < m * 2 - 2; ++t) {
			int mx = 0, cnt = 0;
			for (int i = 0; i < n; ++i) {
				int x = get(a[i], t).a;
				if (x > mx) {
					mx = x;
					cnt = 1;
				}
				else if(x == mx) ++cnt
			}
			if (cnt == 2 && mx > mxt) {
				mxt = mx;
				indt = t;
			}
		}
		/*for (int i = 0; i < n; ++i) {
			int i1 = (i + 1) % n;
			auto p = cross(a[i], a[i1]);
			if (p.first > mxt) {
				mxt = p.first, indt = p.second;
			}
		}*/
		ans.push_back({ add + indt, mxt });
		bool f = false;
		for (int i = 0; i < n; ++i) {
			a[i] = get(a[i], indt);
			if (a[i].a > mxt) exit(0);
			if (a[i].a == mxt && !f) {
				swap(a[i], a[n - 1]);
				--n, --i;
				f = true;
			}
		}
		m = mxt;
		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;
}