#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;
			a.b ^= 1;
		}
		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);
}
bool cmp2(st a, st b) {
	return a.a < b.a;
}
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;
	sort(a, a + n, cmp2);
	int d = m - a[n - 1].a;
	vector<pair<ll, int>> ans;
	for (int i = 0; i < n; ++i) a[i].a += d;
	for (int i = n - 2; i >= 0; --i) {
		if (a[i].a == a[i + 1].a) continue;
		ans.push_back({ d + (m - a[i].a) / 2, (a[i].a + m) / 2 });
	}
	m = (a[0].a + a[n - 1].a) / 2;
	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;
}