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

struct Ant{
    int num;
    char direc;
    Ant(){}
    Ant(int num, char direc):num(num),direc(direc){}
    bool operator<(const Ant& a) const{ return num < a.num; }
    bool operator>(const Ant& a) const{ return num > a.num; }
};

int main(){
    
    while(1){
        int n, l; cin >> n >> l;
        if(!n) break;
        vector<vector<set<Ant> > > tunnel(2, vector<set<Ant> > (l + 1));
    
        
        for(int i = 1; i <= n; i++){
            char d; cin >> d;
            int loc; cin >> loc;
            tunnel[0][loc].insert(Ant(i, d));
        }

        int t = 0;
        int now = 0;
        int next = 1;
        for(;;){

            /*de
            cout << endl;
            for(int i = 0; i <= l; i++){
                cout << i << ": ";
                for(auto ant : tunnel[now][i]){
                    cout << "(" << ant.num << ", " << ant.direc << ") ";
                }
                cout << endl;
            }*/


            int cnt_ant = 0;
            for(int i = 1; i < l; i++){
                cnt_ant += (int)tunnel[now][i].size();
            }
            if(cnt_ant == 0){
                if(tunnel[now][0].size() == 1){
                    for(auto ant : tunnel[now][0]){
                        cout << t << " " << ant.num << endl;
                    }
                }else{
                    for(auto ant : tunnel[now][l]){
                        cout << t << " " << ant.num << endl;
                    }
                }

                break;
            }

            for(int i = 1; i < l; i++){
                for(auto ant : tunnel[now][i]){
                    if(ant.direc == 'R'){
                        tunnel[next][i + 1].insert(ant);
                    }else{
                        tunnel[next][i - 1].insert(ant);
                    }
                }
            }

            for(int i = 1; i < l; i++){
                if(tunnel[next][i].size() == 2){
                    set<Ant> tmp;
                    for(auto ant : tunnel[next][i]){
                        if(ant.direc == 'L') ant.direc = 'R';
                        else ant.direc = 'L';
                        tmp.insert(ant);
                    }
                    tunnel[next][i] = tmp;
                }
            }

            t++;
            swap(now, next);
            for(int i = 0; i <= l; i++) tunnel[next][i].clear();
        }


    }
}
