#include<bits/stdc++.h>
using namespace std;

#define int long

const int MOD = 998244353, MAXN = 431, INF = 1e18;


signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int T;
    cin >> T;
    int n, m;
    cin >> n >> m;
    vector<int> pos(n);
    vector<int> tp(n);
    for(int i = 0; i < n; i++) cin >> pos[i];
    string s;
    cin >> s;
    for(int i = 0; i < n; i++){
        if(s[i] == 'R') tp[i] = 1;
        else tp[i] = -1;
    }
    bool OK = 1;
    for(int i = 1; i < n; i++){
        if(pos[i] % 2 != pos[0] % 2) OK = 0;
    }
    if(!OK){
        cout << "No";
        return 0;
    }
    
    cout << "Yes\n";
    if(T > 1){
        if(m == 1){
            if(T >= 2) cout << 1 << "\n";
            if(T >= 3) cout << 0 << "\n";
            return 0;
        }
        int res = -1, timer = 0;
        vector<pair<int, int>> ord;
        if(tp[0] == tp[1] && pos[0] == pos[1]) res = m;
        else{
            for(int tm = 0; tm <= m; tm++){
                if(pos[0] == pos[1]){
                    ord.push_back({tm, pos[0]});
                    res = pos[0];
                    break;
                }
                for(int i = 0; i < n; i++){
                    pos[i] += tp[i];
                    if(pos[i] == 1) tp[i] = 1;
                    if(pos[i] == m) tp[i] = -1;
                }
            }
        }
        if(T >= 2){
            cout << res << "\n";
        }
        if(T >= 3){
            cout << ord.size() << "\n";
            //cout << (pos[0] + pos[1]) / 2 - 1 << " " << (pos[0] + pos[1]) / 2 << "\n";
            for(auto [x, y] : ord) cout << x << " " << y << "\n";
        }
    }
}