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

#define nn 52
#define ll long long 
#define pii pair<int,int>
#define mp make_pair
pii operator+(pii a,pii b){
	return mp(a.first+b.first,a.second+b.second);
}
pii operator-(pii a,pii b){
	return mp(a.first-b.first,a.second-b.second);
}
char dir[nn][2];int lb[nn],ub[nn];
int goalx,goaly;int n;
int goal;

pii rx[nn],ry[nn];
int face[nn];//-1 or 1
int inter(pii a,pii b){
	if(a.first<=b.second and a.first>=b.first) return a.first;
	if(a.second<=b.second and a.second>=b.first) return a.second;
	if(b.first<=a.second and b.first>=a.first) return b.first;
	if(b.second<=a.second and b.second>=a.first) return b.second;
	assert(0);
}
void output(ll mask){//0=l
	cout<<n<<"\n";
	int d=0;
	for(int i=1;i<=n;i++){
		if(mask&(1ll<<i-1)) d=(d+3)%4;
		else d=(d+1)%4;
		if(d<2) face[i]=1;else face[i]=-1;
	}

	for(int i=n;i>=1;i--){
		rx[i]=rx[i+1],ry[i]=ry[i+1];
		if(i%2){
			if(face[i]==1) ry[i]=ry[i]+mp(lb[i],ub[i]);
			else ry[i]=ry[i]-mp(ub[i],lb[i]);
		}
		else{
			if(face[i]==1) rx[i]=rx[i]+mp(lb[i],ub[i]);
			else rx[i]=rx[i]-mp(ub[i],lb[i]);
		}
	}
//	if(rx[1].first<=goalx and rx[1].second>=goalx);else exit(0);
//	if(ry[1].first<=goaly and ry[1].second>=goaly);else exit(0);
	
	
	int xn=0,yn=0;
	for(int i=1;i<=n;i++){
		rx[i]=mp(goalx,goalx)-rx[i+1]-mp(xn,xn);if(rx[i].first>=rx[i].second) swap(rx[i].first,rx[i].second);
		ry[i]=mp(goaly,goaly)-ry[i+1]-mp(yn,yn);if(ry[i].first>=ry[i].second) swap(ry[i].first,ry[i].second);
		if(mask&(1ll<<i-1)) cout<<"R ",assert(dir[i][0]!='L');else cout<<"L ",assert(dir[i][0]!='R');
		if(face[i]==1){
			if(i%2) yn+=inter(mp(lb[i],ub[i]),ry[i]),cout<<inter(mp(lb[i],ub[i]),ry[i]);
			else xn+=inter(mp(lb[i],ub[i]),rx[i]),cout<<inter(mp(lb[i],ub[i]),rx[i]);
		}
		else{
			if(i%2) yn+=inter(mp(-ub[i],-lb[i]),ry[i]),cout<<abs(inter(mp(-ub[i],-lb[i]),ry[i]));
			else xn+=inter(mp(-ub[i],-lb[i]),rx[i]),cout<<abs(inter(mp(-ub[i],-lb[i]),rx[i]));
		}

		puts("");
	}
	
	assert(xn==goalx and yn==goaly);
	exit(0);
}

void bf(int x,pii askx,pii asky,int d,ll mask){
	if(x>n){
		if(goalx>=askx.first and goalx<=askx.second) 
			if(goaly>=asky.first and goaly<=asky.second)
				output(mask);
		return ;
	}
	if(d==0){
		if(dir[x][0]!='L') bf(x+1,askx,asky-mp(ub[x],lb[x]),3,mask|(1ll<<x-1));
		if(dir[x][0]!='R') bf(x+1,askx,asky+mp(lb[x],ub[x]),1,mask);
	}
	else if(d==1){
		if(dir[x][0]!='R') bf(x+1,askx-mp(ub[x],lb[x]),asky,2,mask);
		if(dir[x][0]!='L') bf(x+1,askx+mp(lb[x],ub[x]),asky,0,mask|(1ll<<x-1));
	}
	else if(d==2){
		if(dir[x][0]!='L') bf(x+1,askx,asky+mp(lb[x],ub[x]),1,mask|(1ll<<x-1));
		if(dir[x][0]!='R') bf(x+1,askx,asky-mp(ub[x],lb[x]),3,mask);
	}
	else if(d==3){
		if(dir[x][0]!='R') bf(x+1,askx+mp(lb[x],ub[x]),asky,0,mask);
		if(dir[x][0]!='L') bf(x+1,askx-mp(ub[x],lb[x]),asky,2,mask|(1ll<<x-1));
	}
}

void solve(int mx,int my){
	int d=0;ll mask=0;
	for(int i=1;i<=n;i++){
		ll ek;
		if(i%2==1){
			if((1<<i/2-1)&my)
				ek=(d==0),d=3;
			else ek=(d==2),d=1;
		}
		else{
			if((1<<i/2-1)&mx)
				ek=(d==3),d=2;
			else ek=(d==1),d=0;
		}
		mask|=(ek<<i-1);
		if(ek==0 and dir[i][0]=='R') return ;
		if(ek==1 and dir[i][0]=='L') return ;
	}
	
	output(mask);
}

vector<int> validx,validy;

void dfs(int x,vector<int> &v,int mask,pii ask){//0=poitive
	if(x>n){
		if(goal>=ask.first and goal<=ask.second) v.push_back(mask);
		return ;
	}
	dfs(x+2,v,mask,ask+mp(lb[x],ub[x]));
	dfs(x+2,v,mask|(1<<x/2-1),ask-mp(ub[x],lb[x]));
}

int main(){
	srand(19);
	int start=clock();
	scanf("%d%d%d",&n,&goalx,&goaly);int cnt=0;
	//if(n>40) exit(0);
	for(int i=1;i<=n;i++){
		scanf("%s%d%d",dir[i],&lb[i],&ub[i]);
		if(dir[i][0]!='?') cnt++;
	}
	if(cnt>=20){
		bf(1,mp(0,0),mp(0,0),0,0);
		return puts("-1"),0;
	}
	
	goal=goaly;dfs(1,validy,0,mp(0,0));
	goal=goalx;dfs(2,validx,0,mp(0,0));
	
	random_shuffle(validx.begin(),validx.end());
	random_shuffle(validy.begin(),validy.end());
	
	if(!validx.size() or !validy.size()) return puts("-1"),0;
	while(clock()-start<=9.5*CLOCKS_PER_SEC){
		int x=rand()%validx.size(),y=rand()%validy.size();
		solve(validx[x],validy[y]);
	}
	puts("-1");
	
	return 0;
} 


Measured memory_bytes: 265252