#include <bits/stdc++.h>

using namespace std;

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

const int MOD = 1e9 + 7;
const int Inf = 2e9;
const ll INF = 3e18;

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int T;
  cin >> T;
  int n, m;
  cin >> n >> m;
  vector <int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  string s;
  cin >> s;
  if (s[0] != s[1] && a[0] % 2 != a[1] % 2) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
    int fir = (a[0] + a[1]) / 2;
    int sec = m - fir + 1;
    if (T >= 2) {
      cout << max(fir, sec) << '\n';
    }
    if (s[0] != s[1]) {
      if (T == 3) {
        cout << "1\n";
        bool rev = ((s[0] == 'L' && a[0] < a[1]) || (s[0] == 'R' && a[0] > a[1]));
        if (fir >= sec) {
          cout << abs(a[0] - a[1]) / 2 + rev * m << ' ' << fir << '\n';
        } else {
          cout << abs(a[0] - a[1]) / 2 + m - rev << ' ' << sec << '\n';
        }
      }
    } else {
      if (T == 3) {
        cout << "1\n";
        if (s[0] == 'R') {
          cout << max(fir, sec) - min(a[0], a[1]) << ' ' << max(fir, sec) << '\n';
        } else {
          cout << max(fir, sec) + min(a[0], a[1]) << ' ' << max(fir, sec) << '\n';
        }
      }
    }
  }
  return 0;
}