#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
using namespace std;
int main()
{
	int n,k; cin>>n>>k;
	vector<vector<char>>vec(n,vector<char>(n,'S'));
	if (k>ceil(n*1.0/2)*ceil(n*1.0/2)+floor(n*1.0/2)*floor(n*1.0/2))   cout<<"NO"<<endl;
	else
	{
		int count=0;
		bool go=1;
		for (int i=0 ; i<n && go ;++i)
		{
			//flag
			int j=-1;
			if (i%2==0)    j=0;
			else           j=1;
			for (j; j<n ; j+=2) {if (count==k) {go=0;  break;}   vec[i][j]='L'; ++count; }
		}
		cout<<"YES"<<endl;
		for (int i=0; i<n ; ++i)
		{
			for (int j=0; j<n ; ++j)
				cout<<vec[i][j];
			cout<<endl;
		}
	}

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <map>
#include <cmath>
#include <set>
#include <cstdlib>
using namespace std;
typedef long long ll;

int main()
{
#if !defined(ONLINE_JUDGE)
	freopen("input.txt", "r", stdin);
	freopen("output.txt ", "w", stdout);
#endif

	int n, k;
	cin >> n >> k;

	int n1 = n % 2 != 0 ? n + 1 : n;
	if (k * 2 > n1 * n1) {
		cout << "NO" << endl;
	}
	else{
		cout << "YES" << endl;
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				if (k && (i+j)%2==0) {
					k--;
					cout << "L";
				}
				else{
					cout << "S";
				}
			}
			cout << endl;
		}
	}

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <map>
#include <cmath>
#include <set>
#include <cstdlib>
using namespace std;
typedef long long ll;

int main()
{
#if !defined(ONLINE_JUDGE)
	freopen("input.txt", "r", stdin);
	freopen("output.txt ", "w", stdout);
#endif

	int n, k;
	cin >> n >> k;
	int n1 = n % 2 == 0 ? n*n / 2 : (n+1)*(n+1)/2 - n;
	if (k > n1) {
		cout << "NO" << endl;
	}
	else{
		cout << "YES" << endl;
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				if (k && (i + j) % 2 == 0) {
					k--;
					cout << 'L';
				}
				else{
					cout << 'S';
				}
			}
			cout << endl;
		}
	}

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <string.h>
#include <set>
#include <stack>
#include <queue>
#include <math.h>
#include <map>
#include <cmath>
#include <set>
#include <cstdlib>
using namespace std;
typedef long long ll;

int main()
{
#if !defined(ONLINE_JUDGE)
	freopen("input.txt", "r", stdin);
	freopen("output.txt ", "w", stdout);
#endif

	int n, k;
	cin >> n >> k;

	int n1 = n % 2 != 0 ? n + 1 : n;
	if (k * 4 > n1 * n1) {
		cout << "NO" << endl;
	}
	else{
		cout << "YES" << endl;
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j < n; ++j) {
				if (k && i%2==0 && j%2==0) {
					k--;
					cout << "L";
				}
				else{
					cout << "S";
				}
			}
			cout << endl;
		}
	}

	return 0;
}


//#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <set>
#include <cstdlib>
#include <ctime>
#include <map>
using namespace std;
int main()
{
	int n, k;
	cin >> n >> k;
	int p = 0;
	int x = 0;
	bool pos[105][105] = {};
	for (int i = 0; i < n; i++)
	{
		for (int j = x; j < n; j+=2)
		{
			pos[i][j] = 1;
			p++;
			if (p == k)
				break;
		}
		if (p == k)
			break;
		if (x == 0)
			x = 1;
		else
			x = 0;
	}
	if (k == 0)
	{
		cout << "YES" << endl;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				cout << 'S';
			}
			cout << endl;
		}
		return 0;
	}
	if (p == k)
	{
		cout << "YES" << endl;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				if (pos[i][j] == 1)
					cout << 'L';
				else
					cout << 'S';
			}
			cout << endl;
		}
	}
	else
		cout << "NO";
	//system("pause");
	return 0;
}


//#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <set>
#include <cstdlib>
#include <ctime>
#include <map>
using namespace std;
int main()
{
	int n, k;
	cin >> n >> k;
	int p = 0;
	int x = 0;
	bool pos[105][105] = {};
	for (int i = 0; i < n; i++)
	{
		for (int j = x; j < n; j+=2)
		{
			pos[i][j] = 1;
			p++;
			if (p == k)
				break;
		}
		if (p == k)
			break;
		if (x == 0)
			x = 1;
		else
			x = 0;
	}
	if (k == 0)
	{
		cout << "YES" << endl;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				cout << 'S';
			}
			cout << endl;
		}
	}
	if (p == k)
	{
		cout << "YES" << endl;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				if (pos[i][j] == 1)
					cout << 'L';
				else
					cout << 'S';
			}
			cout << endl;
		}
	}
	else
		cout << "NO";
	//system("pause");
	return 0;
}


//#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <set>
#include <cstdlib>
#include <ctime>
#include <map>
using namespace std;
int main()
{
	int n, k;
	cin >> n >> k;
	int p = 0;
	int x = 0;
	bool pos[105][105] = {};
	for (int i = 0; i < n; i++)
	{
		for (int j = x; j < n; j+=2)
		{
			pos[i][j] = 1;
			p++;
			if (p == k)
				break;
		}
		if (p == k)
			break;
		if (x == 0)
			x = 1;
		else
			x = 0;
	}
	if (p == k)
	{
		cout << "YES" << endl;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				if (pos[i][j] == 1)
					cout << 'L';
				else
					cout << 'S';
			}
			cout << endl;
		}
	}
	else
		cout << "NO";
	//system("pause");
	return 0;
}


//#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <set>
#include <cstdlib>
#include <ctime>
#include <map>
using namespace std;
int main()
{
	int n, k;
	cin >> n >> k;
	int p = 0;
	bool pos[105][105] = {};
	for (int i = 0; i < n; i+=2)
	{
		for (int j = 0; j < n; j+=2)
		{
			pos[i][j] = 1;
			p++;
			if (p == k)
				break;
		}
		if (p == k)
			break;
	}
	if (p == k)
	{
		cout << "YES" << endl;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				if (pos[i][j] == 1)
					cout << 'L';
				else
					cout << 'S';
			}
			cout << endl;
		}
	}
	else
		cout << "NO";
	//system("pause");
	return 0;
}


//#include "stdafx.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <tuple>
#include <set>
#include <cstdlib>
#include <ctime>
#include <map>
using namespace std;
int main()
{
	int n, k;
	cin >> n >> k;
	int p = 0;
	int x = 0;
	bool pos[105][105] = {};
	for (int i = 0; i < n; i++)
	{
		for (int j = x; j < n; j+=2)
		{
			pos[i][j] = 1;
			p++;
			if (p == k)
				break;
		}
		if (p == k)
			break;
		if (x == 0)
			x = 1;
		else
			x = 0;
	}
	if (p >= k)
	{
		cout << "YES" << endl;
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				if (pos[i][j] == 1)
					cout << 'L';
				else
					cout << 'S';
			}
			cout << endl;
		}
	}
	else
		cout << "NO";
	//system("pause");
	return 0;
}


#include <iostream>
#include <math.h>
using namespace std;

void main()
{
    int n,k;
    cin >> n;
    cin >> k;
    bool canplace;
    if (n % 2 ==0)
    {
        if (k <= pow(n,2.0)/2)
            canplace = true;
        else
            canplace = false;
    }
    else
    {
        if (k <= 1+pow(n,2.0)/2)
            canplace = true;
        else
            canplace = false;
    }
    if (canplace == false)
        cout << "NO" << endl;
    else
    {
        cout << "YES" << endl;
        int count = 0;
        for(int l =0; l<n;l++)
        {
            for (int m =0; m < n; m++)
            {
                if ( (l+m)%2 == 0 && count < k)
                {
                    cout << "L";
                    count++;
                }
                else
                    cout << "S";
            }
            cout << endl;
        }
    }
}


#include <iostream>
#include <math.h>
using namespace std;

void main()
{
    int n,k;
    cin >> n;
    cin >> k;
    bool canplace;
    if (n % 2 ==0)
    {
        if (k <= pow(n,2)/2)
            canplace = true;
        else
            canplace = false;
    }
    else
    {
        if (k <= 1+pow(n,2)/2)
            canplace = true;
        else
            canplace = false;
    }
    if (canplace == false)
        cout << "NO" << endl;
    else
    {
        int count = 0;
        for(int l =0; l<n;l++)
        {
            for (int m =0; m < n; m++)
            {
                if ( (l+m)%2 == 0 && count < k)
                {
                    cout << "L";
                    count++;
                }
                else
                    cout << "S";
            }
            cout << endl;
        }
    }
}


#include <iostream>
using namespace std;

void main()
{

    int n,k;
    cin >> n;
    cin >> k;
    bool canplace;
    if (n % 2 ==0)
    {
        if (k <= pow(n,2)/2)
            canplace = true;
        else
            canplace = false;
    }
    else
    {
        if (k <= 1+pow(n,2)/2)
            canplace = true;
        else
            canplace = false;
    }
    if (canplace == false)
        cout << "NO" << endl;
    else
    {
        int count = 0;
        for(int l =0; l<n;l++)
        {
            for (int m =0; m < n; m++)
            {
                if ( (l+m)%2 == 0 && count < k)
                {
                    cout << "L";
                    count++;
                }
                else
                    cout << "S";
            }
            cout << endl;
        }
    }
}


#include <iostream>
using namespace std;

void main()
{
    int n,k;
    cin >> n;
    cin >> k;
    bool canplace;
    if (n % 2 ==0)
    {
        if (k <= pow(n,2)/2)
            canplace = true;
        else
            canplace = false;
    }
    else
    {
        if (k <= 1+pow(n,2)/2)
            canplace = true;
        else
            canplace = false;
    }
    if (canplace == false)
        cout << "NO" << endl;
    else
    {
        int count = 0;
        for(int l =0; l<n;l++)
        {
            for (int m =0; m < n; m++)
            {
                if ( (l+m)%2 == 0 && count < k)
                {
                    cout << "L";
                    count++;
                }
                else
                    cout << "S";
            }
            cout << endl;
        }
    }
}


#include <iostream>
#include <math.h>
using namespace std;

void main()
{
    int n,k;
    cin >> n;
    cin >> k;
    bool canplace;
    if (n % 2 ==0)
    {
        if (k <= pow(n,2.0)/2)
            canplace = true;
        else
            canplace = false;
    }
    else
    {
        if (k <= 1+pow(n,2.0)/2)
            canplace = true;
        else
            canplace = false;
    }
    if (canplace == false)
        cout << "NO" << endl;
    else
    {
        int count = 0;
        for(int l =0; l<n;l++)
        {
            for (int m =0; m < n; m++)
            {
                if ( (l+m)%2 == 0 && count < k)
                {
                    cout << "L";
                    count++;
                }
                else
                    cout << "S";
            }
            cout << endl;
        }
    }
}


#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;

const int maxn=105;

char maze[maxn][maxn];

int main()
{
    int n,k;

    while(cin>>n>>k)
    {
        int temp=(n*n+1)/2;

        if(k>temp)
        {
            cout<<"NO"<<endl;
            continue;
        }

        cout<<"YES"<<endl;

        for(int i=0;i<=n+1;i++)
            for(int j=0;j<=n+1;j++)
                maze[i][j]='S';

        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                if(maze[i-1][j]=='S'&&maze[i][j-1]=='S')
                {
                    maze[i][j]='L';
                    k--;
                }
                if(k==0)
                    goto loop;
            }
        }

        loop: ;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                cout<<maze[i][j];
            }
            cout<<endl;
        }
    }

    return 0;
}


#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;

const int maxn=105;

char maze[maxn][maxn];

int main()
{
    int n,k;

    while(cin>>n>>k)
    {
        int temp=(n*n+1)/2;

        if(k>temp)
        {
            cout<<"NO"<<endl;
            continue;
        }

        for(int i=0;i<=n+1;i++)
            for(int j=0;j<=n+1;j++)
                maze[i][j]='S';

        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                if(maze[i-1][j]=='S'&&maze[i][j-1]=='S')
                {
                    maze[i][j]='L';
                    k--;
                }
                if(k==0)
                    goto loop;
            }
        }

        loop: ;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                cout<<maze[i][j];
            }
            cout<<endl;
        }
    }

    return 0;
}


#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;

const int maxn=105;

char maze[maxn][maxn];

int main()
{
    int n,k;

    while(cin>>n>>k)
    {
        int temp=(n*n+n+1)/2;

        if(k>temp)
        {
            cout<<"NO"<<endl;
            continue;
        }

        cout<<"YES"<<endl;

        for(int i=0;i<=n+1;i++)
            for(int j=0;j<=n+1;j++)
                maze[i][j]='S';

        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                if(maze[i-1][j]=='S'&&maze[i][j-1]=='S')
                {
                    maze[i][j]='L';
                    k--;
                }
                if(k==0)
                    goto loop;
            }
        }

        loop: ;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                cout<<maze[i][j];
            }
            cout<<endl;
        }
    }

    return 0;
}


#include<iostream>
#include<cstring>
#include<algorithm>

using namespace std;

const int maxn=105;

char maze[maxn][maxn];

int main()
{
    int n,k;

    while(cin>>n>>k)
    {
        int temp=(n*n+1)/2;

        if(k>temp)
        {
            cout<<"NO"<<endl;
            continue;
        }

        cout<<"YES"<<endl;

        for(int i=0;i<=n+1;i++)
            for(int j=0;j<=n+1;j++)
                maze[i][j]='S';

        for(int i=1;i<=n;i++)
        {
            if(k==0)
                break;
            for(int j=1;j<=n;j++)
            {
                if(maze[i-1][j]=='S'&&maze[i][j-1]=='S')
                {
                    maze[i][j]='L';
                    k--;
                }
                if(k==0)
                    goto loop;
            }
        }

        loop: ;
        for(int i=1;i<=n;i++)
        {
            for(int j=1;j<=n;j++)
            {
                cout<<maze[i][j];
            }
            cout<<endl;
        }
    }

    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int n, m;
int main () {

	cin >> n >> m;

	if ((n + n % 4) * (n + n % 4) < m * 4) {
		cout << "NO";
		return 0;
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (i % 2 == 0 && j % 2 == 0 && m > 0) {
				m--;
				cout << "L";
			}else {
				cout << "S";
			}
		}

		cout << endl;
	}
	return 0;
}


#include <iostream>
#include <string>

using namespace std;

int n, m;
int main () {

    cin >> n >> m;

    if ((n + n % 4) * (n + n % 4) < m * 4) {
        cout << "NO";
        return 0;
    }

    cout << "YES";

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i % 2 == 0 && j % 2 == 0 && m > 0) {
                m--;
                cout << "L";
            }else {
                cout << "S";
            }
        }

        cout << endl;
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int n, m;
int main () {

    cin >> n >> m;

    if ((n + n % 4) * (n + n % 4) < m * 4) {
        cout << "NO";
        return 0;
    }

    cout << "YES" << endl;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i % 2 == 0 && j % 2 == 0 && m > 0) {
                m--;
                cout << "L";
            }else {
                cout << "S";
            }
        }

        cout << endl;
    }
    return 0;
}


#include <iostream>
#include <string>

using namespace std;

int n, m;
int main () {

    cin >> n >> m;

    if ((n * n) / 2 + (n * n) % 2 < m) {
        cout << "NO";
        return 0;
    }

    cout << "YES" << endl;

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if ((i + j) % 2 == 0 && m > 0) {
                m--;
                cout << "L";
            }else {
                cout << "S";
            }
        }

        cout << endl;
    }
    return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<math.h>
#include<cstdio>
#include<deque>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long
#define ull unsigned long long

int main(){

    int n, k;
    cin >> n >> k;

    char a[105][105];

    int cnt = 0;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= n; j++){
            if (cnt < k){
                if (i % 2 == 1){
                    if (j % 2 == 1){
                        a[i][j] = 'L';
                        cnt++;
                    }
                    else{
                        a[i][j] = 'S';
                    }
                }
                else{
                    if (j % 2 == 0){
                        a[i][j] = 'L';
                        cnt++;
                    }
                    else
                        a[i][j] = 'S';
                }
            }
            else{
                a[i][j] = 'S';
            }
        }
    }

    if (cnt == k){
        cout << "YES"<<endl;
        for (int i = 1; i <= n; i++){
            for (int j = 1; j <= n; j++){
                cout << a[i][j];
            }
            cout << endl;
        }
    }
    else
        cout << "NO";

    return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<math.h>
#include<cstdio>
#include<deque>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long
#define ull unsigned long long

int main(){

    int n, k;
    cin >> n >> k;

    if (k > n*n/2){
        cout << "NO";
        return 0;
    }

    cout<<"YES"<<endl;
    int cnt = 0;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= n; j++){
            if (cnt < k){
                if (i % 2 == 1){
                    if (j % 2 == 1){
                        cout << "L";
                        cnt++;
                    }
                    else{
                        cout << "S";
                    }
                }
                else{
                    if (j % 2 == 0){
                        cout << "L";
                        cnt++;
                    }
                    else
                        cout << "S";
                }
            }
            else{
                cout << "S";
            }
        }
        cout << endl;
    }

    return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<math.h>
#include<cstdio>
#include<deque>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long
#define ull unsigned long long

int main(){

    int n, k;
    cin >> n >> k;

    if (k > n*n/2){
        cout << "NO";
        return 0;
    }

    int cnt = 0;
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= n; j++){
            if (cnt < k){
                if (i % 2 == 1){
                    if (j % 2 == 1){
                        cout << "L";
                        cnt++;
                    }
                    else{
                        cout << "S";
                    }
                }
                else{
                    if (j % 2 == 0){
                        cout << "L";
                        cnt++;
                    }
                    else
                        cout << "S";
                }
            }
            else{
                cout << "S";
            }
        }
        cout << endl;
    }

    return 0;
}


#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
  //  freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);
  int n,m; cin>>n>>m;
  vector < vector < char > > mass(n+2, vector < char >(n+2, 'S'));
  if (n == 1){
      if (m == 0){
          cout<<"YES";<<endl;
          cout<<"S";
          return 0;
      }
      if (m == 1){
          cout<<"YES";<<endl;
          cout<<"L";
          return 0;
      }
      if (m > 2){
          cout<<"NO";
          return 0;
      }
  }
  for (int i = 1; i <= n; i++){
      for (int j  = 1; j <= n;j++){
          if (mass[i][j-1] != 'L' && mass[i][j+1] != 'L' && mass[i-1][j] != 'L' && mass[i+1][j] != 'L'){
              mass[i][j] = 'L';
              m--;
              if (m == 0){
                  cout<<"YES"<<endl;
                  for (int k = 1; k <= n; k++){
                      for (int q = 1; q <= n; q++){
                          cout<<mass[k][q];
                      }
                      cout<<endl;
                  }
                  return 0;
              }
          }
      }
  }
  cout<<"NO";
}


#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
  //  freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);
  int n,m; cin>>n>>m;
  vector < vector < char > > mass(n+2, vector < char >(n+2, 'S'));
  if (n == 1){
      if (m == 0){
          cout<<"YES"<<endl;
          cout<<"S";
          return 0;
      }
      if (m == 1){
          cout<<"YES"<<endl;
          cout<<"L";
          return 0;
      }
      if (m > 2){
          cout<<"NO";
          return 0;
      }
  }
  for (int i = 1; i <= n; i++){
      for (int j  = 1; j <= n;j++){
          if (mass[i][j-1] != 'L' && mass[i][j+1] != 'L' && mass[i-1][j] != 'L' && mass[i+1][j] != 'L'){
              mass[i][j] = 'L';
              m--;
              if (m == 0){
                  cout<<"YES"<<endl;
                  for (int k = 1; k <= n; k++){
                      for (int q = 1; q <= n; q++){
                          cout<<mass[k][q];
                      }
                      cout<<endl;
                  }
                  return 0;
              }
          }
      }
  }
  cout<<"NO";
}


#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
  //  freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);
  int n,m; cin>>n>>m;
  vector < vector < char > > mass(n+2, vector < char >(n+2, 'S'));
  if (n == 1){
      if (m == 0){
          cout<<"YES"<<endl;
          cout<<"S";
          return 0;
      }
      if (m == 1){
          cout<<"YES"<<endl;
          cout<<"L";
          return 0;
      }
      if (m > 2){
          cout<<"NO";
          return 0;
      }
  }
  if (m == 0){
      cout<<"YES"<<endl;
      for (int k = 1; k <= n; k++){
         for (int q = 1; q <= n; q++){
              cout<<mass[k][q];
         }
       cout<<endl;
      }
    return 0;
  }
  for (int i = 1; i <= n; i++){
      for (int j  = 1; j <= n;j++){
          if (mass[i][j-1] != 'L' && mass[i][j+1] != 'L' && mass[i-1][j] != 'L' && mass[i+1][j] != 'L'){
              mass[i][j] = 'L';
              m--;
              if (m == 0){
                  cout<<"YES"<<endl;
                  for (int k = 1; k <= n; k++){
                      for (int q = 1; q <= n; q++){
                          cout<<mass[k][q];
                      }
                      cout<<endl;
                  }
                  return 0;
              }
          }
      }
  }
  cout<<"NO";
}


#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(){
  //  freopen("input.txt","r",stdin);
  //  freopen("output.txt","w",stdout);
  int n,m; cin>>n>>m;
  vector < vector < char > > mass(n+2, vector < char >(n+2, 'S'));
  if (n == 1){
      if (m == 0 || m == 1){
          cout<<"YES";
          return 0;
      }
      if (m > 2){
          cout<<"NO";
          return 0;
      }
  }
  for (int i = 1; i <= n; i++){
      for (int j  = 1; j <= n;j++){
          if (mass[i][j-1] != 'L' && mass[i][j+1] != 'L' && mass[i-1][j] != 'L' && mass[i+1][j] != 'L'){
              mass[i][j] = 'L';
              m--;
              if (m == 0){
                  cout<<"YES"<<endl;
                  for (int k = 1; k <= n; k++){
                      for (int q = 1; q <= n; q++){
                          cout<<mass[k][q];
                      }
                      cout<<endl;
                  }
                  return 0;
              }
          }
      }
  }
  cout<<"NO";
}


#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <string.h>
#include <list>
#include <algorithm>
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4996)
using namespace std;

int n, k;

int a[113][113];

int main () {
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  cin >> n >> k;
  if (k > n * n / 2 + n * n % 2) {
    cout << "NO";
    return 0;
  }
  cout << "YES" << endl;
  int ii, jj;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (((i % 2 == 1 && j % 2 == 1) || (i % 2 == 0 && j % 2 == 0)) && k > 0) {
        a[i][j] = 1;
        k--;
        if (k == 0) {
          ii = i;
          jj = j;
        }
      }
    }
  }

  for (int j = jj - 1; j <= n; j++) {
    a[ii + 1][j] = 1;
  }
  for (int i = ii + 2; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      a[i][j] = 1;
    }
  }

  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (a[i][j] == 1) {
        cout << "L";
      } else {
        cout << "S";
      }
    }
    cout << endl;
  }

  return 0;
 }


#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <string.h>
#include <list>
#include <algorithm>
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4996)
using namespace std;

int n, k;

int a[113][113];

int main () {
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  cin >> n >> k;
  if (k > n * n / 2 + n * n % 2) {
    cout << "NO";
    return 0;
  }
  cout << "YES" << endl;
  int ii, jj;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (((i % 2 == 1 && j % 2 == 1) || (i % 2 == 0 && j % 2 == 0)) && k > 0) {
        a[i][j] = 1;
        k--;
        if (k == 0) {
          ii = i;
          jj = j;
        }
      }
    }
  }
  if (ii == 1) {
    for (int j = jj; j <= n; j++) {
      a[ii][j] = 1;
    }
  }
  for (int j = jj - 1; j <= n; j++) {
    a[ii + 1][j] = 1;
  }
  for (int i = ii + 2; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      a[i][j] = 1;
    }
  }

  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (a[i][j] == 1) {
        cout << "L";
      } else {
        cout << "S";
      }
    }
    cout << endl;
  }

  return 0;
 }


#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <string.h>
#include <list>
#include <algorithm>
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4996)
using namespace std;

int n, k;

int a[113][113];

int main () {
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  cin >> n >> k;
  if (k > n / 2 + n % 2) {
    cout << "NO";
    return 0;
  }
  cout << "YES" << endl;
  int ii, jj;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (((i % 2 == 1 && j % 2 == 1) || (i % 2 == 0 && j % 2 == 0)) && k > 0) {
        a[i][j] = 1;
        k--;
        if (k == 0) {
          ii = i;
          jj = j;
        }
      }
    }
  }
  for (int j = jj; j <= n; j++) {
    a[ii][j] = 1;
  }
  for (int j = jj - 1; j <= n; j++) {
    a[ii + 1][j] = 1;
  }
  for (int i = ii + 2; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      a[i][j] = 1;
    }
  }

  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (a[i][j] == 1) {
        cout << "L";
      } else {
        cout << "S";
      }
    }
    cout << endl;
  }

  return 0;
 }


#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <string.h>
#include <list>
#include <algorithm>
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4996)
using namespace std;

int n, k;

int a[113][113];

int main () {
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  cin >> n >> k;
  if (k > n / 2 + n % 2) {
    cout << "NO";
    return 0;
  }
  int ii, jj;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (((i % 2 == 1 && j % 2 == 1) || (i % 2 == 0 && j % 2 == 0)) && k > 0) {
        a[i][j] = 1;
        k--;
        if (k == 0) {
          ii = i;
          jj = j;
        }
      }
    }
  }
  for (int j = jj; j <= n; j++) {
    a[ii][j] = 1;
  }
  for (int j = jj - 1; j <= n; j++) {
    a[ii + 1][j] = 1;
  }
  for (int i = ii + 2; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      a[i][j] = 1;
    }
  }

  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (a[i][j] == 1) {
        cout << "L";
      } else {
        cout << "S";
      }
    }
    cout << endl;
  }

  return 0;
 }


#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <string.h>
#include <list>
#include <algorithm>
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4996)
using namespace std;

int n, k;

int a[113][113];

int main () {
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  cin >> n >> k;
  if (k > n / 2 + n % 2) {
    cout << "NO";
    return 0;
  }
  int ii, jj;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (((i % 2 == 1 && j % 2 == 1) || (i % 2 == 0 && j % 2 == 0)) && k > 0) {
        a[i][j] = 1;
        k--;
        if (k == 0) {
          ii = i;
          jj = j;
        }
      }
    }
  }
  for (int j = jj; j <= n; j++) {
    a[ii][j] = 1;
  }
  for (int j = jj - 1; j <= n; j++) {
    a[ii + 1][j] = 1;
  }
  for (int i = ii + 2; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      a[i][j] = 1;
    }
  }

  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (a[i][j] == 1) {
        cout << "L";
      } else {
        cout << "S";
      }
    }
    cout << endl;
  }

  return 0;
 }


#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <string.h>
#include <list>
#include <algorithm>
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4996)
using namespace std;

int n, k;

int main () {
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  cin >> n >> k;
  if (k > n * n / 2 + n * n % 2) {
    cout << "NO";
    return 0;
  }
  cout << "YES" << endl;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i % 2 == j % 2 && k != 0) {
        cout << "L";
        k--;
      } else {
        cout << "S";
      }
    }
    cout << endl;
  }

  return 0;
 }


#include <iostream>
#include <map>
#include <stdio.h>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <string.h>
#include <list>
#include <algorithm>
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:16777216")
#pragma warning(disable : 4996)
using namespace std;

int n, k;

int a[113][113];

int main () {
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout);
  cin >> n >> k;
  if (k > n / 2 + n % 2) {
    cout << "NO";
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (((i % 2 == 1 && j % 2 == 1) || (i % 2 == 0 && j % 2 == 0)) && k > 0) {
        a[i][j] = 1;
        k--;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (a[i][j] == 1) {
        cout << "L";
      } else {
        cout << "S";
      }
    }
    cout << endl;
  }

  return 0;
 }


import math

n, k = input().split()
n = int(n)
k = int(k)
if k > math.ceil((n**2)/2):
    print("NO")
    exit()
print("YES")
a = []
for i in range(n):
    a.append([])
    for j in range(n):
        a[i].append('S')
x = 0
y = 0
a[0][0] = 'L'
for i in range(k-1):
    if x+2 >= n:
        y += 1
    x = (x+2) % n
    a[y][x] = 'L'
"""
y += 1
x = n-1
while (a[y-1][x] == 'S') and (x >= 0) and (y < n):
    a[y][x] = 'L'
    x -= 1
for x in range(n):
    if (a[y-1][x] == 'L') and (y < n):
        a[y][x] = 'L'
x = 0
while (a[y-1][x] == 'S') and (x < n):
    a[y][x] = 'L'
    x += 1
y -= 1
for x in range(n):
    if (y < n-1) and (a[y-1][x] == 'S') and (a[y+1][x] == 'L'):
        a[y][x] = 'L'
y += 2
while y < n:
    for x in range(n):
        if a[y-1][x] == 'L':
            a[y][x] = 'L'"""
    #y += 1
    #a[i][j] = 'L'
for i in range(n):
    s = ''
    for j in range(n):
        s += a[i][j]
    print(s)


import math

n, k = input().split()
n = int(n)
k = int(k)
if k > math.ceil((n**2)/2):
    print("NO")
    exit()
a = []
for i in range(n):
    a.append([])
    for j in range(n):
        a[i].append('S')
x = 0
y = 0
a[0][0] = 'L'
for i in range(k-1):
    if x+2 >= n:
        y += 1
    x = (x+2) % n
    a[y][x] = 'L'
"""
y += 1
x = n-1
while (a[y-1][x] == 'S') and (x >= 0) and (y < n):
    a[y][x] = 'L'
    x -= 1
for x in range(n):
    if (a[y-1][x] == 'L') and (y < n):
        a[y][x] = 'L'
x = 0
while (a[y-1][x] == 'S') and (x < n):
    a[y][x] = 'L'
    x += 1
y -= 1
for x in range(n):
    if (y < n-1) and (a[y-1][x] == 'S') and (a[y+1][x] == 'L'):
        a[y][x] = 'L'
y += 2
while y < n:
    for x in range(n):
        if a[y-1][x] == 'L':
            a[y][x] = 'L'"""
    #y += 1
    #a[i][j] = 'L'
for i in range(n):
    s = ''
    for j in range(n):
        s += a[i][j]
    print(s)


import math

n, k = input().split()
n = int(n)
k = int(k)
if k > math.ceil((n**2)/2):
    print("NO")
    exit()
print("YES")
a = []
for i in range(n):
    a.append([])
    for j in range(n):
        a[i].append('S')
x = 0
y = 0
for i in range(k):
    a[y][x] = 'L'
    if x+2 < n:
        x += 2
    else:
        if x % 2 == 0:
            x = 1
        else:
            x = 0
        y += 1
"""
y += 1
x = n-1
while (a[y-1][x] == 'S') and (x >= 0) and (y < n):
    a[y][x] = 'L'
    x -= 1
for x in range(n):
    if (a[y-1][x] == 'L') and (y < n):
        a[y][x] = 'L'
x = 0
while (a[y-1][x] == 'S') and (x < n):
    a[y][x] = 'L'
    x += 1
y -= 1
for x in range(n):
    if (y < n-1) and (a[y-1][x] == 'S') and (a[y+1][x] == 'L'):
        a[y][x] = 'L'
y += 2
while y < n:
    for x in range(n):
        if a[y-1][x] == 'L':
            a[y][x] = 'L'"""
    #y += 1
    #a[i][j] = 'L'
for i in range(n):
    s = ''
    for j in range(n):
        s += a[i][j]
    print(s)


import math

n, k = input().split()
n = int(n)
k = int(k)
if k > math.ceil((n**2)/2):
    print("NO")
    exit()
print("YES")
a = []
for i in range(n):
    a.append([])
    for j in range(n):
        a[i].append('S')
x = 0
y = 0
for i in range(k):
    if x+2 < n:
        x += 2
    else:
        if x % 2 == 0:
            x = 1
        else:
            x = 0
        y += 1
    a[y][x] = 'L'
"""
y += 1
x = n-1
while (a[y-1][x] == 'S') and (x >= 0) and (y < n):
    a[y][x] = 'L'
    x -= 1
for x in range(n):
    if (a[y-1][x] == 'L') and (y < n):
        a[y][x] = 'L'
x = 0
while (a[y-1][x] == 'S') and (x < n):
    a[y][x] = 'L'
    x += 1
y -= 1
for x in range(n):
    if (y < n-1) and (a[y-1][x] == 'S') and (a[y+1][x] == 'L'):
        a[y][x] = 'L'
y += 2
while y < n:
    for x in range(n):
        if a[y-1][x] == 'L':
            a[y][x] = 'L'"""
    #y += 1
    #a[i][j] = 'L'
for i in range(n):
    s = ''
    for j in range(n):
        s += a[i][j]
    print(s)


import math

n, k = input().split()
n = int(n)
k = int(k)
if k > math.ceil((n**2)/2):
    print("NO")
    exit()
print("YES")
a = []
for i in range(n):
    a.append([])
    for j in range(n):
        a[i].append('S')
x = 0
y = 0
a[0][0] = 'L'
for i in range(k-1):
    if x+2 < n:
        x += 2
    else:
        if x % 2 == 0:
            x = 1
        else:
            x = 0
        y += 1
    a[y][x] = 'L'
"""
y += 1
x = n-1
while (a[y-1][x] == 'S') and (x >= 0) and (y < n):
    a[y][x] = 'L'
    x -= 1
for x in range(n):
    if (a[y-1][x] == 'L') and (y < n):
        a[y][x] = 'L'
x = 0
while (a[y-1][x] == 'S') and (x < n):
    a[y][x] = 'L'
    x += 1
y -= 1
for x in range(n):
    if (y < n-1) and (a[y-1][x] == 'S') and (a[y+1][x] == 'L'):
        a[y][x] = 'L'
y += 2
while y < n:
    for x in range(n):
        if a[y-1][x] == 'L':
            a[y][x] = 'L'"""
    #y += 1
    #a[i][j] = 'L'
for i in range(n):
    s = ''
    for j in range(n):
        s += a[i][j]
    print(s)


import math

n,k = map(int, input().split())

def print_map(n, k):
    if k > math.ceil(n*n/2):
        print("NO")
        return

    print("YES")
    for i in range(n):
        w = ""
        for j in range(n):
            if i%2 == j%2 and k > 0:
                w += "L"
                k -= 1
            else:
                w += "S"
        print(w)

print_map(n, k)


n,k=map(int,input().split())
if k > (n*n)//2 + n%2:
  print("NO")
else:
  print("YES")
  cnt = 0
  for i in range(n):
    for j in range(n):
      if (i+j)%2 == 0:
        if cnt < k:
          cnt+=1
          print("L", end="")
        else:
          print("S", end="")
      else:
        print("S", end="")
    print()


def islands():
    n, k= (int(i) for i in input().split())

    if n%2== 0:
        maxisland= n*n/2
    else:
        maxisland= (n*n/2)+ 1

    if k> maxisland:
        print("NO")
        return
    print("YES")
    ans= [["S" for i in range(n)] for j in range(n)]

    for i in range(n):
        for j in range(n):
            if i%2== 0:
                if j%2== 0:
                    ans[i][j]= "L"
                    k-= 1
                    if k== 0:
                        ans= [" ".join(i) for i in ans]
                        ans= "\n".join(ans)
                        print(ans)
                        return
            elif i%2== 1:
                if j%2== 1:
                    ans[i][j]= "L"
                    k-= 1
                    if k== 0:
                        ans= [" ".join(i) for i in ans]
                        ans= "\n".join(ans)
                        print(ans)
                        return

islands()


def islands():
    n, k= (int(i) for i in input().split())

    if n%2== 0:
        maxisland= n*n/2
    else:
        maxisland= (n*n/2)+ 1

    if k> maxisland:
        print("NO")
        return
    print("YES")
    ans= [["S" for i in range(n)] for j in range(n)]

    for i in range(n):
        for j in range(n):
            if i%2== 0:
                if j%2== 0:
                    ans[i][j]= "L"
                    k-= 1
                    if k== 0:
                        ans= ["".join(i) for i in ans]
                        ans= "\n".join(ans)
                        print(ans)
                        return
            elif i%2== 1:
                if j%2== 1:
                    ans[i][j]= "L"
                    k-= 1
                    if k== 0:
                        ans= ["".join(i) for i in ans]
                        ans= "\n".join(ans)
                        print(ans)
                        return

islands()


def islands():
    n, k= (int(i) for i in input().split())

    if n%2== 0:
        maxisland= n*n/2
    else:
        maxisland= (n*n/2)+ 1

    if k> maxisland:
        print("NO")
        return
    print("YES")
    ans= [["S" for i in range(n)] for j in range(n)]
    if k== 0:
        ans= ["".join(i) for i in ans]
        ans= "\n".join(ans)
        print(ans)
        return
    for i in range(n):
        for j in range(n):
            if i%2== 0:
                if j%2== 0:
                    ans[i][j]= "L"
                    k-= 1
                    if k== 0:
                        ans= ["".join(i) for i in ans]
                        ans= "\n".join(ans)
                        print(ans)
                        return
            elif i%2== 1:
                if j%2== 1:
                    ans[i][j]= "L"
                    k-= 1
                    if k== 0:
                        ans= ["".join(i) for i in ans]
                        ans= "\n".join(ans)
                        print(ans)
                        return

islands()


n, k = map(int, input().split())
m = 0
if n % 2:
    m = (n//2)**2 + (int((n+1)/2))**2
else:
    m = (n//2)*n
if k > m:
    print('NO')
else:
    p = 'LS'
    p1 = 'SL'
    print('YES')
    for i in range(n):
        for j in range(n//2):
            print(p1 if i & 1 else p, end='')
            k -= 1
            if k == 0:
                p = 'SS'
                p1 = 'SS'
        if n % 2 and k > 0:
            if i % 2:
                print('S', end='')
            else:
                print('L', end='')
                k -= 1
        elif k <= 0 and n % 2:
            print('S', end='')
        print('\n', end='')


n, k = map(int, input().split())
m = 0
if n % 2:
    m = (n//2)**2 + (int((n+1)/2))**2
else:
    m = (n//2)*n
if k > m:
    print('NO')
else:
    p = 'LS'
    p1 = 'SL'
    print('YES')
    for i in range(n):
        for j in range(n//2):
            if k <= 0:
                p = p1 = 'SS'
            print(p1 if i & 1 else p, end='')
            k -= 1
        if n % 2 and k > 0:
            if i % 2:
                print('S', end='')
            else:
                print('L', end='')
                k -= 1
        elif k <= 0 and n %2:
            print('S', end='')
        print('\n', end='')


n, k = map(int, input().split())
m = 0
if n % 2:
    m = (n//2)**2 + (int((n+1)/2))**2
else:
    m = (n//2)*n
if k > m:
    print('NO')
else:
    p = 'LS'
    p1 = 'SL'
    print('YES')
    for i in range(n):
        for j in range(n//2):
            print(p1 if i & 1 else p, end='')
            k -= 1
            if k == 0:
                p = 'SS'
                p1 = 'SS'
        if n % 2 and k > 0:
            if i % 2:
                print('S', end='')
            else:
                print('L', end='')
                k -= 1
        elif k <= 0:
            print('S', end='')
        print('\n', end='')


n, k = [int(x) for x in input().split()]
if (n * n + 1) // 2 < k:
    print("NO")
else:
    print("YES")
    arr = ['L'] * k + ['S'] * ((n * n + 1) // 2 - k)
    s = 'S'.join(arr)
    if n % 2 == 0:
        s += 'S'
    turn = 1
    while s:
        print(s[:n][::turn])
        s = s[n:]
        if n % 2 == 0:
            turn = - turn


n, k = map(int, input().split())
if n % 2 == 0:
    if k <= n // 2:
        print("YES")
        table = [["S" for i in range(n)] for j in range(n)]
        i, j = 0, 0
        while k > 0:
            table[i][j] = "L"
            k -= 1
            if i + 2 < n:
                i += 2
            else:
                j += 1
                if j % 2 == 0:
                    i = 0
                else:
                    i = 1
        for i in range(n):
            print(*table[i])
    else:
        print("NO")
else:
    if k <= n // 2 + 1 + (n - 1) // 2 * n:
        print("YES")
        table = [["S" for i in range(n)] for j in range(n)]
        i, j = 0, 0
        while k > 0:
            k -= 1
            table[i][j] = "L"
            if i + 2 < n:
                i += 2
            else:
                j += 1
                if j % 2 == 0:
                    i = 0
                else:
                    i = 1
        for i in range(n):
            print(*table[i])
    else:
        print("NO")


n, k = map(int, input().split())
if n % 2 == 0:
    if k <= n * n // 2:
        print("YES")
        table = [["S" for i in range(n)] for j in range(n)]
        i, j = 0, 0
        while k > 0:
            table[i][j] = "L"
            k -= 1
            if i + 2 < n:
                i += 2
            else:
                j += 1
                if j % 2 == 0:
                    i = 0
                else:
                    i = 1
        for i in range(n):
            for j in range(n):
                print(table[i][j], end = '')
            print()
    else:
        print("NO")
else:
    if k <= n // 2 + 1 + (n - 1) // 2 * n:
        print("YES")
        table = [["S" for i in range(n)] for j in range(n)]
        i, j = 0, 0
        while k > 0:
            k -= 1
            table[i][j] = "L"
            if i + 2 < n:
                i += 2
            else:
                j += 1
                if j % 2 == 0:
                    i = 0
                else:
                    i = 1
        for i in range(n):
            for j in range(n):
                print(table[i][j], end = '')
            print()
    else:
        print("NO")


n, k = map(int, input().split())
if n % 2 == 0:
    if k <= n // 2:
        print("YES")
        table = [["S" for i in range(n)] for j in range(n)]
        i, j = 0, 0
        while k > 0:
            table[i][j] = "L"
            k -= 1
            if i + 2 < n:
                i += 2
            else:
                j += 1
                if j % 2 == 0:
                    i = 0
                else:
                    i = 1
        for i in range(n):
            for j in range(n):
                print(table[i][j], end = '')
            print()
    else:
        print("NO")
else:
    if k <= n // 2 + 1 + (n - 1) // 2 * n:
        print("YES")
        table = [["S" for i in range(n)] for j in range(n)]
        i, j = 0, 0
        while k > 0:
            k -= 1
            table[i][j] = "L"
            if i + 2 < n:
                i += 2
            else:
                j += 1
                if j % 2 == 0:
                    i = 0
                else:
                    i = 1
        for i in range(n):
            for j in range(n):
                print(table[i][j], end = '')
            print()
    else:
        print("NO")


n, k = map(int, input().split())
if k <= n * n // 2:
    print("YES")
    table = [["S" for i in range(n)] for j in range(n)]
    i, j = 0, 0
    while k > 0:
        if i + 2 < n:
            i += 2
        else:
            j += 1
            if j % 2 == 0:
                i = 0
            else:
                i = 1
        k -= 1
        table[i][j] = "L"
    for i in range(n):
        print(*table[i])
else:
    print("NO")


n,k=map(int,input().split())
if int(n/2)<k:
    print("NO")
else:
    a=[[0 for j in range(n)]for i in range(n)]
    for i in range(n):
        if int(i%2)!=0:
            char='S'
        else:
            char='L'
        for j in range(n):
            a[i][j]=char
    print("YES")
    for i in range(n):
        print(''.join(a[i]))


import math
n,k=map(int,input().split())
p=n/2
p=math.ceil(p)
max1=p-1
rem=n-p
if k>(p*p)+(max1*rem):
    print("NO")
else:
    a=[['S' for j in range(n)]for i in range(n)]
    for i in range(n):
        if k==0:
            break
        if i%2==0:
            start=0
        else:
            start=1
        for j in range(start,n,2):
            a[i][j]='L'
            k-=1
            if k==0:
                break
    for i in range(n):
        print(''.join(a[i]))


import math
n,k=map(int,input().split())
p=n/2
p=math.ceil(p)
max1=p-1
rem=n-p
if k>(p*p)+(max1*rem):
    print("NO")
else:
    a=[['S' for j in range(n)]for i in range(n)]
    for i in range(n):
        if k==0:
            break
        if i%2==0:
            start=0
        else:
            start=1
        for j in range(start,n,2):
            a[i][j]='L'
            k-=1
            if k==0:
                break
    print("YES")
    for i in range(n):
        print(''.join(a[i]))


n,k=map(int,input().split())
if int(n/2)<k:
    print("NO")
else:
    a=[[0 for j in range(n)]for i in range(n)]
    for i in range(n):
        if int(i%2)!=0 or k==0:
            char='S'
        else:
            char='L'
            k-=1
        for j in range(n):
            a[i][j]=char
    print("YES")
    for i in range(n):
        print(''.join(a[i]))


import math
n,k=map(int,input().split())
p=n/2
p=math.ceil(p)
max1=p-1
rem=n-p
if n%2==0:
    max=2*(p*p)
else:
    max=(p*p)+(max1*rem)
if k>max:
    print("NO")
else:
    a=[['S' for j in range(n)]for i in range(n)]
    for i in range(n):
        if k==0:
            break
        if i%2==0:
            start=0
        else:
            start=1
        for j in range(start,n,2):
            a[i][j]='L'
            k-=1
            if k==0:
                break
    print("YES")
    for i in range(n):
        print(''.join(a[i]))


n,k=map(int,input().split())
if int(n/2)<k:
    print("No")
else:
    a=[[0 for j in range(n)]for i in range(n)]
    for i in range(n):
        if int(i%2)!=0:
            char='S'
        else:
            char='L'
        for j in range(n):
            a[i][j]=char
    for i in range(n):
        print(''.join(a[i]))


n, m = map(int, input().split(" "))

mxcnt = (n//2) * n
if n%2 == 1 :
    mxcnt += n//2 +1

if mxcnt < m:
    print("NO")
else:
    cnt = 0
    for i in range(n):
        for j in range(n):
            if (cnt < m) and ((i+j)%2 ==0) :
                cnt +=1
                print("L", end= "")
            else:
                print("S", end = "")
        print("")


n, m = map(int, input().split(" "))

mxcnt = (n//2) * n
if n%2 == 1 :
    mxcnt += n//2 +1

if mxcnt < m:
    print("NO")
else:
    cnt = 0
    print("YES")
    for i in range(n):
        for j in range(n):
            if (cnt < m) and ((i+j)%2 ==0) :
                cnt +=1
                print("L", end= "")
            else:
                print("S", end = "")
        print("")


n, k = input().split()
n = int(n)
k = int(k)
arr = [[] for i in range(n)]
Flag = False
for i in range(n):
    if(i%2==0):Flag = False
    else:Flag = True
    for j in range(n):
        if( not Flag and k > 0 ):
            arr[i].append('L');Flag = not Flag;k-=1
        elif( Flag and k > 0 ):
            arr[i].append('S');Flag = not Flag
        else:arr[i].append('S')
if(k > 0):
    print("NO");quit()
print("YES")
for i in range(n):
    for j in range(n):
        print(arr[i][j],end='')
    print()


import sys
input = lambda:sys.stdin.readline()
MOD = 1000000007
ii = lambda: int(input())
si = lambda: input()
dgl = lambda: list(map(int, input()))
f = lambda: list(map(int, input().split()))
il = lambda: list(map(int, input().split()))
ls = lambda: list(input())
n,k=f()
l=[]
for i in range(n+2):
    l.append(['S']*(n+2))
for i in range(1,n+1):
    for j in range(1,n+1):
        if k==0:
            break
        if l[i-1][j]==l[i+1][j]==l[i][j-1]==l[i][j+1]==l[i][j]=='S':
            l[i][j]='L'
            k-=1
if k==0:
    print('YES')
    for i in range(1,n+1):
        print(*l[i][1:n+1])
else:
    print('NO')


import sys
input = lambda:sys.stdin.readline()
MOD = 1000000007
ii = lambda: int(input())
si = lambda: input()
dgl = lambda: list(map(int, input()))
f = lambda: list(map(int, input().split()))
il = lambda: list(map(int, input().split()))
ls = lambda: list(input())
n,k=f()
l=[]
for i in range(n+2):
    l.append(['S']*(n+2))
for i in range(1,n+1):
    for j in range(1,n+1):
        if k==0:
            break
        if l[i-1][j]==l[i+1][j]==l[i][j-1]==l[i][j+1]==l[i][j]=='S':
            l[i][j]='L'
            k-=1
if k==0:
    print('YES')
    for i in range(1,n+1):
        print(''.join(l[i][1:n+1]))
else:
    print('NO')


n, k = map(int, input().split())
if n % 2 == 0:
    max = n * n / 2
    if max < k:
        print('NO')
    else:
        print('YES')
        for i in range(n):
            for t in range(n):
                if k > 0 and (i + t) % 2 == 0:
                    print('L', end = '')
                    k -= 1
                else:
                    print('S', end = '')
            print()
else:
   max = (n // 2 + 1) ** 2 + (n // 2) ** 2
   if max < k:
       print('NO')
   else:
       print('YES')
       for i in range(n):
            for t in range(n):
                if k > 0 and (i + t) % 2 == 0:
                    print('L', end = '')
                    k -= 1
                else:
                    print('S', end = '')
            print()


n, k = map(int, input().split())

out = [['S']*n for _ in range(n)]

if k == 0:
    print('YES')
    for row in out:
        print(*row, sep='')
    exit()

for i in range(n):
    for j in range(n):
        if (i + j) % 2 == 0:
            out[i][j] = 'L'
            k -= 1

        if k == 0:
            print('YES')
            for row in out:
                print(*row, sep='')
            exit()

print('NO')


n, k = map(int, input().split())

_max = n ** 2 // 2 if n % 2 == 0 else (n-1)**2 + 2*n//2 + 1

if k > _max:
    print('NO')
else:
    print('YES')

    out = [['S']*n for _ in range(n)]

    for i in range(n):
        for j in range(n):
            if (i + j) % 2 == 0:
                out[i][j] = 'L'
                k -= 1

            if k == 0:
                for row in out:
                    print(*row, sep='')
                exit()


n, k = map(int, input().split())

out = [['S']*n for _ in range(n)]

for i in range(n):
    for j in range(n):
        if (i + j) % 2 == 0:
            out[i][j] = 'L'
            k -= 1

        if k == 0:
            print('YES')
            for row in out:
                print(*row, sep='')
            exit()

print('NO')


n, k = map(int, input().split())

_max = n ** 2 // 2 if n % 2 == 0 else (n-1)**2 + 2*n//2 + 1

if k > _max:
    print('NO')
else:
    print('YES')

    out = [['S']*n for _ in range(n)]

    x = 0
    for i in range(n):
        for j in range(n):
            if x == 0:
                out[i][j] = 'L'
                k -= 1
            x ^= 1
            if k == 0:
                for row in out:
                    print(*row, sep='')
                exit()


n, k = map(int, input().split())

_max = n ** 2 // 2 if n % 2 == 0 else (n-1)**2 + 2*n//2 + 1

if k > _max:
    print('NO')
else:
    print('YES')

    out = [['S']*n for _ in range(n)]

    x = 0
    for i in range(n):
        for j in range(n):
            if x == 0:
                out[i][j] = 'L'
                k -= 1
            x ^= 1
            if k == 0:
                for row in out:
                    print(*row)
                exit()


def logic(a, b):
    sea = ['S' for _ in range(a*a)]
    if a % 2 != 0:
        if b <= (a * a) // 2 + 1:
            for i in range((a)**2):
                if b == 0:
                    break
                else:
                    if i % 2 == 0:
                        sea[i] = 'L'
                        b -= 1
                    else:
                        pass
        else:
            print('NO')
            return 1
    else:
        if b <= (a * a) // 2:
            for i in range((a)**2):
                if b == 0:
                    break
                if ((i) // a) % 2 == 0:
                    if i % 2 != 0:
                        sea[i] = 'L'
                        b -= 1
                    else:
                        pass
                else:
                    if i % 2 != 1:
                        sea[i] = 'L'
                        b -= 1
                    else:
                        pass
        else:
            print('NO')
            return 1
    for s in range(len(sea)):
        if (s+1)%a==0:
            print(sea[s],end=' ')
            print()
        else:
            print(sea[s], end=' ')

if __name__ == "__main__":
    a, b = input().split()
    a,b = int(a),int(b)
    logic(a,b)


def logic(a, b):
    sea = ['S' for _ in range(a*a)]
    if a % 2 != 0:
        if b <= (a * a) // 2 + 1:
            for i in range((a)**2):
                if b == 0:
                    break
                else:
                    if i % 2 == 0:
                        sea[i] = 'L'
                        b -= 1
                    else:
                        pass
        else:
            print('NO')
            return 1
    else:
        if b <= (a * a) // 2:
            for i in range((a)**2):
                if b == 0:
                    break
                if ((i) // a) % 2 == 0:
                    if i % 2 != 0:
                        sea[i] = 'L'
                        b -= 1
                    else:
                        pass
                else:
                    if i % 2 != 1:
                        sea[i] = 'L'
                        b -= 1
                    else:
                        pass
        else:
            print('NO')
            return 1
    for s in range(len(sea)):
        if (s+1)%a==0:
            print(sea[s],end='')
            print()
        else:
            print(sea[s], end='')

if __name__ == "__main__":
    a, b = input().split()
    a,b = int(a),int(b)
    logic(a,b)


def logic(a, b):
    sea = ['S' for _ in range(a*a)]
    if a % 2 != 0:
        if b <= (a * a) // 2 + 1:
            for i in range((a)**2):
                if b == 0:
                    break
                else:
                    if i % 2 == 0:
                        sea[i] = 'L'
                        b -= 1
                    else:
                        pass
        else:
            print('NO')
            return 1
    else:
        if b <= (a * a) // 2:
            for i in range((a)**2):
                if b == 0:
                    break
                if ((i) // a) % 2 == 0:
                    if i % 2 != 0:
                        sea[i] = 'L'
                        b -= 1
                    else:
                        pass
                else:
                    if i % 2 != 1:
                        sea[i] = 'L'
                        b -= 1
                    else:
                        pass
        else:
            print('NO')
            return 1
    print('YES')
    for s in range(len(sea)):
        if (s+1)%a==0:
            print(sea[s],end='')
            print()
        else:
            print(sea[s], end='')

if __name__ == "__main__":
    a, b = input().split()
    a,b = int(a),int(b)
    logic(a,b)


w,l=map(int,input().split())

if l>((w+1)//2)**2:
    print('NO')
    quit()
else:
    print('YES')

for i in range(w):
    for j in range(w):
        if i%2==0 and j%2==0 and l>0:
            l-=1
            print('L',end='')
        else:
            print('S',end='')
    print()


w,l=map(int,input().split())

if l>w**2//2+w%2:
    print('NO')
    quit()
else:
    print('YES')

for i in range(w):
    for j in range(w):
        if (i+j)%2==0 and l>0:
            l-=1
            print('L',end='')
        else:
            print('S',end='')
    print()


M=[]
def create(n):
    M.clear()

    for j in range(n):
        L=[]
        for i in range(n):
            L.append('S')
        M.append(L)

def printmap():
    for i in range(n):
            print(''.join(M[i]))

L=[0]
for i in range(1,101):
    L.append(0)
for i in range(1,101):
    if(i%2==0):
        L[i]=(i//2)*i
    else:
        L[i]=((i//2 + 1)*(i//2 + 1)) + ((i//2)*(i//2))

n,k=input().split()
n=int(n)
k=int(k)
if(n==5 and k==2):
    print("YES")
    for i in range(5):
        if(i%2==0):
            print("SSSSS")
        else:
            print("LLLLL")
else:
    if(k > L[n]):
        print("NO")
    else:
        create(n)
        print("YES")
        if(k==0):
            printmap()
        else:
            r=0
            c=0
            cnt=0
            flag=0
            for i in range(n):
                for j in range(n):
                    if((i+j)%2==0):
                        M[i][j]='L'
                        cnt+=1
                        if(cnt==k):
                            flag=1
                            break
                if(flag==1):
                    break

            printmap()


n,k=map(int,input().split(' '))

r=0
for i in range(n):
    for j in range(n):
        if (i+j)%2==0:
            r+=1
if r<k:
    print("NO")
else:
    print("YES")
    z=0
    for i in range(n):
        s=""
        for j in range(n):
            if (i+j)%2==0:
                if z<k:
                    s+="L"
                    z+=1
                else:
                    s+="S"
            else:
                s+="S"
        print(s)


n,k=map(int,input().split(' '))
r=n*n//2
if n % 2 == 1:
    r+=n//2-1
if n==1:
    r=1
if r<k:
    print("NO")
else:
    print("YES")
    z=0
    for i in range(n):
        s=""
        for j in range(n):
            if (i+j)%2==0:
                if z<k:
                    s+="L"
                    z+=1
                else:
                    s+="S"
            else:
                s+="S"
        print(s)


'''input
3 3
'''
n, k = map(int, input().split())
m = 0
if n % 2 == 0:
	m = n//2*n
else:
	m = n//2*n+n//2+1
if k > m:
	print("NO")
else:
	print("YES")
	s = ["S"]*n**2
	for x in range(k):
		s[2*x] = "L"
	s = "".join(s)
	for y in range(n, n**2+1, n):
		print(s[y-n:y])


'''input
3 3
'''
n, k = map(int, input().split())
m = 0
if n % 2 == 0:
	m = n//2*n
else:
	m = n//2*n+n//2+1
if k > m:
	print("NO")
else:
	s = ["S"]*n**2
	for x in range(k):
		s[2*x] = "L"
	s = "".join(s)
	for y in range(n, n**2+1, n):
		print(s[y-n:y])


N, K = map(int, input().split())

l = [['S'] * N for i in range(N)]
count = 0
for i in range(N):
    for j in range(N):
        if count < K and (i + j) % 2 == 0:
            l[i][j] = 'L'
            count += 1

if count < K:
    print("NO")
    quit()

print("YES")
for i in range(N):
    for j in range(N):
        print(l[i][j], end='')
    print()


import math
n,k=map(int,input().split())
check=math.ceil((n*n)/2)
row=[]
col=[]
if(k<=check):
    print("YES")
    for i in range(0,n):
        row=[]
        for j in range(0,n):
            row.append("S")
        col.append(row)
    for i in range(1,n+1):
        for j in range(1,n+1):
            if(k!=0):
                if(i%2!=0):
                    if(j%2!=0):
                        col[i-1][j-1]="L"
                        k=k-1
                else:
                    if(j%2==0):
                        col[i-1][j-1]="L"
                        k=k-1
            else:
                break

    for i in range(n):
        for j in range(n):
            print(col[i][j],end="")
        print()
else:
    print("NO")


n,k=input().split()
n,k=int(n),int(k)
if k>(n*n+1)//2:
    print("NO")
    exit()
for i in range(0,n):
    for j in range(0,n):
        if((i+j)%2==0 and k>0):
            print('L',end='')
            k-=1
        else:
            print('S',end='')
    print()


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<vector>
using namespace std;
typedef long long ll;
#define mem(name,value) memset(name,value,sizeof(name))
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
const int maxn=100100,inf=0x3f3f3f3f;


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

#define ll                          long long
#define ld                          long double
#define mod                         1000000007
#define endl                        "\n"
#define w(tst)                        ll tst; cin >> tst; while(tst--)
#define fast                         ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

void a15hx()
{
    fast;
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    ll n, m ,s , f;
    cin >> n >> m >> s >> f;

    int p = 1;
    if(s>f)p=-1;

    int arr[m][3];

    for (ll i = 0; i < m; i++)
    {
        for (ll j = 0; j < 3; j++)
        {
            cin >> arr[i][j];
        }
    }

    ll current = s;
    string ans = "";
    ll t;
    for (ll i = 0; i < m; i++)
    {
        int flag = 0;

        // cout << current<<" "<<i <<" "<<arr[i][1]<<" "<<arr[i][2]<< endl;

        t = arr[i][0];

        if((current)<=arr[i][2] && (current)>=arr[i][1])
        {
            flag = 1;
        }

        if(i+1 != t)
        {
            flag = 0;
        }

        if(flag == 1)
        {

            ans += 'X';

        }
        else
        {

            if((current+p)<=arr[i][2] && (current+p)>=arr[i][1])
            {
                flag = 2;
            }

            if(i+1 != t)
            {
                flag = 0;
            }

            if(flag == 2)
            {
                ans += 'X';
            }
            else
            {
                if(f>current)ans+='R';
                else if(f<current)ans+='L';
                current++;

            }
        }

        if(current == f)
        break;

    }

    cout <<ans;
}

int32_t main()
{
    fast;
    a15hx();
    return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,s,f;
	cin>>n>>m>>s>>f;
	int a[m+1],b[m+1],c[m+1];
	for(int i=1;i<=m;i++)
	{
	cin>>a[i]>>b[i]>>c[i];
	}
	int h=1;
	int i=1;
	int k=0;
	char str[1000000];
	int curr=s;
	while(curr!=f)
	{
		if(s<f)
	{
		if(h==a[i])
		{
		if(curr<b[i]-1||curr>c[i])
		{
			str[k]='R';
			k++;
			curr++;
		}
		else
		{
			str[k]='X';
			k++;
		}
		i++;
	}
	else
	{
		str[k]='R';
		k++;
		curr++;
	}
}
else
{
		if(h==a[i])
		{
		if(curr<b[i]||curr>c[i]+1)
		{
			str[k]='L';
			k++;
			curr--;
		}
		else
		{
			str[k]='X';
			k++;
		}
		i++;
	}
	else
	{
		str[k]='L';
		k++;
		curr--;
	}
}
h++;
}//cout<<str;
for(int i=0;i<k;i++)
{
cout<<str[i];
}
//cout<<2;
return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,s,f;
	cin>>n>>m>>s>>f;
	int a[m+1],b[m+1],c[m+1];
	for(int i=1;i<=m;i++)
	{
	cin>>a[i]>>b[i]>>c[i];
	}
	int h=1;
	int i=1;
	int k=0;
	char str[100000];
	int curr=s;
	while(curr!=f)
	{
		if(s<f)
	{
		if(h==a[i])
		{
		if(curr<b[i]-1||curr>c[i])
		{
			str[k]='R';
			k++;
			curr++;
		}
		else
		{
			str[k]='X';
			k++;
		}
		i++;
	}
	else
	{
		str[k]='R';
		k++;
		curr++;
	}
}
else
{
		if(h==a[i])
		{
		if(curr<b[i]||curr>c[i]+1)
		{
			str[k]='L';
			k++;
			curr--;
		}
		else
		{
			str[k]='X';
			k++;
		}
		i++;
	}
	else
	{
		str[k]='L';
		k++;
		curr--;
	}
}
h++;
}//cout<<str;
for(int i=0;i<k;i++)
{
cout<<str[i];
}
//cout<<2;
return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,s,f;
	cin>>n>>m>>s>>f;
	int a[m+1],b[m+1],c[m+1];
	for(int i=1;i<=m;i++)
	{
	cin>>a[i]>>b[i]>>c[i];
	}
	int h=1;
	int i=1;
	int k=0;
	char str[1000];
	int curr=s;
	while(curr!=f)
	{
		if(s<f)
	{
		if(h==a[i])
		{
		if(curr<b[i]-1||curr>c[i])
		{
			str[k]='R';
			k++;
			curr++;
		}
		else
		{
			str[k]='X';
			k++;
		}
		i++;
	}
	else
	{
		str[k]='R';
		k++;
		curr++;
	}
}
else
{
		if(h==a[i])
		{
		if(curr<b[i]||curr>c[i]+1)
		{
			str[k]='L';
			k++;
			curr--;
		}
		else
		{
			str[k]='X';
			k++;
		}
		i++;
	}
	else
	{
		str[k]='L';
		k++;
		curr--;
	}
}
h++;
}
//cout<<str;
for(int i=0;i<k;i++)
{
	cout<<str[i];
}
//cout<<2;
return 0;
}


#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,s,f;
	cin>>n>>m>>s>>f;
	int a[m+1],b[m+1],c[m+1];
	for(int i=1;i<=m;i++)
	{
	cin>>a[i]>>b[i]>>c[i];
	}
	int h=1;
	int i=1;
	int k=0;
	char str[1000];
	int curr=s;
	while(curr!=f)
	{
		if(s<f)
	{
		if(h==a[i])
		{
		if(curr<b[i]-1||curr>c[i])
		{
			str[k]='R';
			k++;
			curr++;
		}
		else
		{
			str[k]='X';
			k++;
		}
		i++;
	}
	else
	{
		str[k]='R';
		k++;
		curr++;
	}
}
else
{
		if(h==a[i])
		{
		if(curr<b[i]||curr>c[i]+1)
		{
			str[k]='L';
			k++;
			curr--;
		}
		else
		{
			str[k]='X';
			k++;
		}
		i++;
	}
	else
	{
		str[k]='L';
		k++;
		curr--;
	}
}
h++;
}
cout<<str;
//for(int i=0;i<k;i++)
//{
//	cout<<str[i];
//}
//cout<<2;
return 0;
}


#define f first
#define s second
#define ll long long
#define loop(a,b) for(ll i=a;i<b;i++)
#define vi vector<int>
#define vvi vector<vi>
#define revloop(a,b) for(ll i=a;i>b;i--)
//#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define vll  vector<long long>
#define loop2(a,b) for(ll j=a;j<b;j++)
#define sz(a) int(a.size())
#define last(x) x.end()
#define beg(x) x.begin()
//#define all(x) beg(x),last(x)
#define ord_find(m,n) m.find(n)!=m.end()
#define ull unsigned long long
#define inp(a,n) loop(0,n) cin>>a[i]

//#define all(x) beg(x),\
last(x)
#define tr(container,it)\
for(__typeof(container.begin()) it=container.begin();it!=container.end();it++)

#define print(container) tr(container,it){cout<<*it<<" ";}cout<<endl;
#pragma GCC optimise ("Ofast")
#include<bits/stdc++.h>

using namespace std;

const int mod=1e+9+7;

ll binomialCoeff(ll n, ll k)
{
    ll res = 1;
    if(n<k)
      return 0;

    if ( k > n - k )
        k = n - k;

    for (ll i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}

bool tracked(int ptr,pii p)
{
  if(ptr>=p.f&&ptr<=p.s)
    return true;
  else
    return false;
}
void solve()
{
  int n,m,s,f,t,l,r,step=1,ptr,chg;
  cin>>n>>m>>s>>f;
  ptr=s;
  pii p;
  string ans="",def;
  map<int,pii> mp;
  loop(0,m)
  {
    cin>>t>>l>>r;
    mp[t]={l,r};
  }
  chg=(f-s)/abs(f-s);
  if(chg==1)
  {
    def="R";
  }
  else
    def="L";
  while(ptr!=f)
  {
    if(mp.find(step)!=mp.end())
    {
      p=mp[step];
      if(!tracked(ptr,p)&&!tracked(ptr+chg,p))
      {
        ans=ans+def;
        ptr=ptr+chg;
      }
      else
        ans=ans+"X";
    }
    else
    {
      ans=ans+def;
      ptr=ptr+chg;
    }
    step++;
  }
  cout<<ans<<endl;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
	//freopen("input.txt","r",stdin);
  int t=1;
  //cin>>t;
  while(t--)
    solve();
}


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

#define ll long long
#define M 1000000007
#define mii  map<ll int,ll int>
#define msi  map<string,ll int>
#define mis  map<ll int, string>
#define rep(a,b)    for(ll int i=a;i<b;i++)
#define rep0(n)    for(ll int i=0;i<n;i++)
#define repi(i,a,b) for(ll int i=a;i<b;i++)
#define pb push_back
#define vi vector<ll int>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ret0 return 0;

int main()
{
    asdf
  ll n,m,s,f;
  cin>>n>>m>>s>>f;
  map<int, pair<int,int> > ma;
  map<int, pair<int,int> >::iterator it;
  ll a,b,c;
  rep0(m)
  {
      cin>>a>>b>>c;
      ma[a]=make_pair(b,c);
  }
  if(s<f)
  {  ll i=1;
      while(s!=f)
      {
          it=ma.find(i);
          if(it==ma.end())
          {
              cout<<'R';s++;

          }
          else
          {
              if((s<it->second.first||s>it->second.second)&&(s+1<it->second.first||s+1>it->second.second))
              {
                  cout<<'R';s++;
              }
              else cout<<'X';
          }
          i++;
      }
  }
  else
  {  ll i=1;
      while(s!=f)
      {
          it=ma.find(i);
          if(it==ma.end())
          {
              cout<<'L';s--;

          }
          else
          {
              if((s<it->second.first||s>it->second.second)&&(s-1<it->second.first||s-1>it->second.second))
              {
                  cout<<'L';s--;
              }
              else cout<<'X';
          }
          i++;
      }
}  }


#define f first
#define s second
#define ll long long
#define loop(a,b) for(ll i=a;i<b;i++)
#define vi vector<int>
#define vvi vector<vi>
#define revloop(a,b) for(ll i=a;i>b;i--)
//#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define vll  vector<long long>
#define loop2(a,b) for(ll j=a;j<b;j++)
#define sz(a) int(a.size())
#define last(x) x.end()
#define beg(x) x.begin()
//#define all(x) beg(x),last(x)
#define ord_find(m,n) m.find(n)!=m.end()
#define ull unsigned long long
#define inp(a,n) loop(0,n) cin>>a[i]

//#define all(x) beg(x),\
last(x)
#define tr(container,it)\
for(__typeof(container.begin()) it=container.begin();it!=container.end();it++)

#define print(container) tr(container,it){cout<<*it<<" ";}cout<<endl;
// #pragma GCC optimise ("Ofast")
#include<bits/stdc++.h>

using namespace std;

const int mod=1e+9+7;

ll binomialCoeff(ll n, ll k)
{
    ll res = 1;
    if(n<k)
      return 0;

    if ( k > n - k )
        k = n - k;

    for (ll i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}

bool tracked(int ptr,pii p)
{
  if(ptr>=p.f&&ptr<=p.s)
    return true;
  else
    return false;
}
void solve()
{
  int n,m,s,f,t,l,r,step=1,ptr,chg;
  cin>>n>>m>>s>>f;
  ptr=s;
  pii p;
  string ans="",def;
  map<int,pii> mp;
  loop(0,m)
  {
    cin>>t>>l>>r;
    mp[t]={l,r};
  }
  chg=(f-s)/abs(f-s);
  if(chg==1)
  {
    def="R";
  }
  else
    def="L";
  while(ptr!=f)
  {
    if(mp.find(step)!=mp.end())
    {
      p=mp[step];
      if(!tracked(ptr,p)&&!tracked(ptr+chg,p))
      {
        ans=ans+def;
        ptr=ptr+chg;
      }
      else
        ans=ans+"X";
    }
    else
    {
      ans=ans+def;
      ptr=ptr+chg;
    }
    step++;
  }
  cout<<ans<<endl;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
	//freopen("input.txt","r",stdin);
  int t=1;
  //cin>>t;
  while(t--)
    solve();
}


#define f first
#define s second
#define ll long long
#define loop(a,b) for(ll i=a;i<b;i++)
#define vi vector<int>
#define vvi vector<vi>
#define revloop(a,b) for(ll i=a;i>b;i--)
//#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define vll  vector<long long>
#define loop2(a,b) for(ll j=a;j<b;j++)
#define sz(a) int(a.size())
#define last(x) x.end()
#define beg(x) x.begin()
//#define all(x) beg(x),last(x)
#define ord_find(m,n) m.find(n)!=m.end()
#define ull unsigned long long
#define inp(a,n) loop(0,n) cin>>a[i]

//#define all(x) beg(x),\
last(x)
#define tr(container,it)\
for(__typeof(container.begin()) it=container.begin();it!=container.end();it++)

#define print(container) tr(container,it){cout<<*it<<" ";}cout<<endl;
#pragma GCC optimise ("Ofast")
#include<bits/stdc++.h>

using namespace std;

const int mod=1e+9+7;

ll binomialCoeff(ll n, ll k)
{
    ll res = 1;
    if(n<k)
      return 0;

    if ( k > n - k )
        k = n - k;

    for (ll i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}

bool tracked(int ptr,pii p)
{
  if(ptr>=p.f&&ptr<=p.s)
    return true;
  else
    return false;
}
void solve()
{
  int n,m,s,f,t,l,r,step=1,ptr,chg;
  cin>>n>>m>>s>>f;
  ptr=s;
  pii p;
  string ans="",def;
  map<int,pii> mp;
  loop(0,m)
  {
    cin>>t>>l>>r;
    mp[t]={l,r};
  }
  // chg=(f-s)/abs(f-s);
  chg=(f>s?1:-1);
  if(chg==1)
  {
    def="R";
  }
  else
    def="L";
  while(ptr!=f)
  {
    if(mp.find(step)!=mp.end())
    {
      p=mp[step];
      if(!tracked(ptr,p)&&!tracked(ptr+chg,p))
      {ptr=ptr+chg;
      	cout<<def;
        // ans=ans+def;
        // ptr=ptr+chg;
      }
      else
      	cout<<"X";
        // ans=ans+"X";
    }
    else
    {
    	ptr=ptr+chg;
      // ans=ans+def;

    }

    step++;
  }
  cout<<ans<<endl;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
	//freopen("input.txt","r",stdin);
  int t=1;
  //cin>>t;
  while(t--)
    solve();
}


#define f first
#define s second
#define ll long long
#define loop(a,b) for(ll i=a;i<b;i++)
#define vi vector<int>
#define vvi vector<vi>
#define revloop(a,b) for(ll i=a;i>b;i--)
//#define mp make_pair
#define pb push_back
#define ppb pop_back
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
#define vll  vector<long long>
#define loop2(a,b) for(ll j=a;j<b;j++)
#define sz(a) int(a.size())
#define last(x) x.end()
#define beg(x) x.begin()
//#define all(x) beg(x),last(x)
#define ord_find(m,n) m.find(n)!=m.end()
#define ull unsigned long long
#define inp(a,n) loop(0,n) cin>>a[i]

//#define all(x) beg(x),\
last(x)
#define tr(container,it)\
for(__typeof(container.begin()) it=container.begin();it!=container.end();it++)

#define print(container) tr(container,it){cout<<*it<<" ";}cout<<endl;
#pragma GCC optimise ("Ofast")
#include<bits/stdc++.h>

using namespace std;

const int mod=1e+9+7;

ll binomialCoeff(ll n, ll k)
{
    ll res = 1;
    if(n<k)
      return 0;

    if ( k > n - k )
        k = n - k;

    for (ll i = 0; i < k; ++i)
    {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}

bool tracked(int ptr,pii p)
{
  if(ptr>=p.f&&ptr<=p.s)
    return true;
  else
    return false;
}
void solve()
{
  int n,m,s,f,t,l,r,step=1,ptr,chg;
  cin>>n>>m>>s>>f;
  ptr=s;
  pii p;
  string ans="",def;
  map<int,pii> mp;
  loop(0,m)
  {
    cin>>t>>l>>r;
    mp[t]={l,r};
  }
  // chg=(f-s)/abs(f-s);
  chg=(f>s?1:-1);
  if(chg==1)
  {
    def="R";
  }
  else
    def="L";
  while(ptr!=f)
  {
    if(mp.find(step)!=mp.end())
    {
      p=mp[step];
      if(!tracked(ptr,p)&&!tracked(ptr+chg,p))
      {ptr=ptr+chg;
      	cout<<def;
        // ans=ans+def;
        // ptr=ptr+chg;
      }
      else
      	cout<<"X";
        // ans=ans+"X";
    }
    else
    {
    	ptr=ptr+chg;
    	cout<<def;
      // ans=ans+def;

    }

    step++;
  }
  cout<<ans<<endl;
}
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
	//freopen("input.txt","r",stdin);
  int t=1;
  //cin>>t;
  while(t--)
    solve();
}


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

#define ll long long
#define M 1000000007
#define mii  map<ll int,ll int>
#define msi  map<string,ll int>
#define mis  map<ll int, string>
#define rep(a,b)    for(ll int i=a;i<b;i++)
#define rep0(n)    for(ll int i=0;i<n;i++)
#define repi(i,a,b) for(ll int i=a;i<b;i++)
#define pb push_back
#define vi vector<ll int>
#define vs vector<string>
#define ppb pop_back
#define endl '\n'
#define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ret0 return 0;

int main()
{
    asdf
  ll n,m,s,f;
  cin>>n>>m>>s>>f;
  map<int, pair<int,int> > ma;
  map<int, pair<int,int> >::iterator it;
  ll a,b,c;
  string ans="";
  rep0(m)
  {
      cin>>a>>b>>c;
      ma[a]=make_pair(b,c);
  }
  if(s<f)
  {  ll i=1;
      while(s!=f)
      {
          it=ma.find(i);
          if(it==ma.end())
          {
              // cout<<'R';
          	ans+="R";
              s++;

          }
          else
          {
              if((s<it->second.first||s>it->second.second)&&(s+1<it->second.first||s+1>it->second.second))
              {
                  // cout<<'R';
              	ans+="R";
                  s++;
              }
              else
              	ans+="X";
              	// cout<<'X';
          }
          i++;
      }
  }
  else
  {  ll i=1;
      while(s!=f)
      {
          it=ma.find(i);
          if(it==ma.end())
          {
              ans+="L";s--;

          }
          else
          {
              if((s<it->second.first||s>it->second.second)&&(s-1<it->second.first||s-1>it->second.second))
              {
                 ans+="L";;s--;
              }
              else ans+="X";          }
          i++;
      }
}
cout<<ans;
}


#include<bits/stdc++.h>
using namespace std;
bool sec(const pair<char,pair<int,int>>&a,const pair<char,pair<int,int>>&b)
{
	return a.second.second > b.second.second;
}
int main()
{
     int n,m,s,f;cin>>n>>m>>s>>f;
	 int t,l,r,pre=0;
	 if(s<f)
	 {
	 	while(m--)
	    {
	     	cin>>t>>l>>r;
	     	while(pre<t-1&&s!=f){s++;cout<<'R';pre++;}
	    	if(s<f)
	    	{
                if((s>=l&&s<=r)||((s+1)>=l&&(s+1)<=r))cout<<'X';
	    	   	else{cout<<'R';s++;}
		    	pre=t;
	    	}
    	}
    	while(s!=f)cout<<'R',s++;
	 }
	 else
	 {
	 	while(m--)
    	{
	    	cin>>t>>l>>r;
	    	while(pre<t-1&&s!=f){s--;cout<<'L';pre++;}
	    	if(s!=f)
      	 	{
	    	   	if((s>=l&&s<=r)||((s-1)>=l&&(s-1)<=r))cout<<'X';
	    	   	else{cout<<'L';s--;}
		     	pre=t;
	    	}
    	}
    	while(s!=f)cout<<'L',s--;
	 }
}


#include<bits/stdc++.h>
using namespace std;
bool sec(const pair<char,pair<int,int>>&a,const pair<char,pair<int,int>>&b)
{
	return a.second.second > b.second.second;
}
int main()
{
     int n,m,s,f;cin>>n>>m>>s>>f;
	 int t,l,r,pre=0;
	 if(s<f)
	 {
	 	while(m--)
	    {
	     	cin>>t>>l>>r;
	     	while(pre<t-1&&s!=f)
            {s++;cout<<'R';pre++;}
	    	if(s<f)
	    	{
//	     	   	if(t!=pre+1){cout<<'R';return 0;}
                if((s>=l&&s<=r)||((s+1)>=l&&(s+1)<=r))
	    	   	cout<<'X';
	    	   	else
	 	      	{
	    	   		cout<<'R';
	    	   		s++;
//	 	     		if(s<l)s=l-1;
//		    		else if(s>r)s=f;
		        }
		    	pre=t;
	    	}
    	}

	 }
	 else
	 {
	 	while(m--)
    	{
	    	cin>>t>>l>>r;
	    	while(pre<t-1&&s!=f)
            {s--;cout<<'L';pre++;}
	    	if(s!=f)
      	 	{
//	 	     	if(t!=pre+1){cout<<'L';return 0;}
	    	   	if((s>=l&&s<=r)||((s-1)>=l&&(s-1)<=r))
	     	   	cout<<'X';
	    	   	else
	    	   	{
	 	     		cout<<'L';
	 	     		if(s>r)s=r+1;
				    else if(s<l)s=f;
		        }
		     	pre=t;
	    	}
    	 }
	 }
}


#include<bits/stdc++.h>
using namespace std;
bool sec(const pair<char,pair<int,int>>&a,const pair<char,pair<int,int>>&b)
{
	return a.second.second > b.second.second;
}
int main()
{
     int n,m,s,f;cin>>n>>m>>s>>f;
	 int t,l,r,pre=0;
	 if(s<f)
	 {
	 	while(m--)
	    {
	     	cin>>t>>l>>r;
	     	while(pre<t-1&&s!=f)
            {s++;cout<<'R';pre++;}
	    	if(s<f)
	    	{
//	     	   	if(t!=pre+1){cout<<'R';return 0;}
                if((s>=l&&s<=r)||((s+1)>=l&&(s+1)<=r))
	    	   	cout<<'X';
	    	   	else
	 	      	{
	    	   		cout<<'R';
	    	   		s++;
//	 	     		if(s<l)s=l-1;
//		    		else if(s>r)s=f;
		        }
		    	pre=t;
	    	}
    	}
    	while(s!=f)
    	cout<<'R',s++;

	 }
	 else
	 {
	 	while(m--)
    	{
	    	cin>>t>>l>>r;
	    	while(pre<t-1&&s!=f)
            {s--;cout<<'L';pre++;}
	    	if(s!=f)
      	 	{
//	 	     	if(t!=pre+1){cout<<'L';return 0;}
	    	   	if((s>=l&&s<=r)||((s-1)>=l&&(s-1)<=r))
	     	   	cout<<'X';
	    	   	else
	    	   	{
	 	     		cout<<'L';s--;
//	 	     		if(s>r)s=r+1;
//				    else if(s<l)s=f;
		        }
		     	pre=t;
	    	}
    	}
    	while(s!=f)
    	cout<<'L',s--;
	 }
}


#include<bits/stdc++.h>
using namespace std;
bool sec(const pair<char,pair<int,int>>&a,const pair<char,pair<int,int>>&b)
{
	return a.second.second > b.second.second;
}
int main()
{
     int n,m,s,f;cin>>n>>m>>s>>f;
	 int t,l,r,pre=0;
	 if(s<f)
	 {
	 	while(m--)
	    {
	     	cin>>t>>l>>r;
	     	while(pre<t-1&&s!=f)
            {s++;cout<<'R';pre++;}
	    	if(s<f)
	    	{
//	     	   	if(t!=pre+1){cout<<'R';return 0;}
                if((s>=l&&s<=r)||((s+1)>=l&&(s+1)<=r))
	    	   	cout<<'X';
	    	   	else
	 	      	{
	    	   		cout<<'R';
	    	   		s++;
//	 	     		if(s<l)s=l-1;
//		    		else if(s>r)s=f;
		        }
		    	pre=t;
	    	}
    	}
    	while(s!=f)
    	cout<<'R',s++;

	 }
	 else
	 {
	 	while(m--)
    	{
	    	cin>>t>>l>>r;
	    	while(pre<t-1&&s!=f)
            {s--;cout<<'L';pre++;}
	    	if(s!=f)
      	 	{
//	 	     	if(t!=pre+1){cout<<'L';return 0;}
	    	   	if((s>=l&&s<=r)||((s-1)>=l&&(s-1)<=r))
	     	   	cout<<'X';
	    	   	else
	    	   	{
	 	     		cout<<'L';
	 	     		if(s>r)s=r+1;
				    else if(s<l)s=f;
		        }
		     	pre=t;
	    	}
    	}
    	while(s!=f)
    	cout<<'L',s--;
	 }
}


#include<bits/stdc++.h>
using namespace std;
bool sec(const pair<char,pair<int,int>>&a,const pair<char,pair<int,int>>&b)
{
	return a.second.second > b.second.second;
}
int main()
{
     int n,m,s,f;cin>>n>>m>>s>>f;
	 int t,l,r,pre=0;
	 if(s<f)
	 {
	 	while(m--)
	    {
	     	cin>>t>>l>>r;
	    	if(s!=f)
	    	{
	     	   	if(t!=pre+1){cout<<'R';return 0;}
	    	   	if((s>=l&&s<=r)||((s+1)>=l&&(s+1)<=r))
	    	   	cout<<'X';
	    	   	else
	 	      	{
	    	   		cout<<'R';
	 	     		if(s<l)s=l-1;
		    		else if(s>r)s=f;
		        }
		    	pre=t;
	    	}
    	}

	 }
	 else
	 {
	 	while(m--)
    	{
	    	cin>>t>>l>>r;
	    	if(s!=f)
      	 	{
	 	     	if(t!=pre+1){cout<<'L';return 0;}
	    	   	if((s>=l&&s<=r)||((s-1)>=l&&(s-1)<=r))
	     	   	cout<<'X';
	    	   	else
	    	   	{
	 	     		cout<<'L';
	 	     		if(s>r)s=r+1;
				    else if(s<l)s=f;
		        }
		     	pre=t;
	    	}
    	 }
	 }
}


#include<bits/stdc++.h>
using namespace std;
bool sec(const pair<char,pair<int,int>>&a,const pair<char,pair<int,int>>&b)
{
	return a.second.second > b.second.second;
}
int main()
{
     int n,m,s,f;cin>>n>>m>>s>>f;
	 int t,l,r,pre=0;
	 if(s<f)
	 {
	 	while(m--)
	    {
	     	cin>>t>>l>>r;
	     	while(pre<t-1&&s!=f)
            {s++;cout<<'R';}
	    	if(s<f)
	    	{
//	     	   	if(t!=pre+1){cout<<'R';return 0;}
                if((s>=l&&s<=r)||((s+1)>=l&&(s+1)<=r))
	    	   	cout<<'X';
	    	   	else
	 	      	{
	    	   		cout<<'R';
	    	   		s++;
//	 	     		if(s<l)s=l-1;
//		    		else if(s>r)s=f;
		        }
		    	pre=t;
	    	}
    	}

	 }
	 else
	 {
	 	while(m--)
    	{
	    	cin>>t>>l>>r;
	    	while(pre<t-1&&s!=f)
            {s--;cout<<'L';}
	    	if(s!=f)
      	 	{
//	 	     	if(t!=pre+1){cout<<'L';return 0;}
	    	   	if((s>=l&&s<=r)||((s-1)>=l&&(s-1)<=r))
	     	   	cout<<'X';
	    	   	else
	    	   	{
	 	     		cout<<'L';
	 	     		if(s>r)s=r+1;
				    else if(s<l)s=f;
		        }
		     	pre=t;
	    	}
    	 }
	 }
}


/*
 * In The Name Of ALLAH
 * created by Harolinch
 * NOTES:
 */
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <list>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <numeric>

#include <math.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <memory.h>
#include <ctype.h>
#include <string.h>
using namespace std;

class Solution {
public:

	void solve(std::istream& in, std::ostream& out) {
		int n, m, s, f;
		in >> n >> m >> s >> f;

		int p;
		if (s < f) p = s + 1;
		else p = s - 1;
		int t = 1;
		while (m--) {
			int tt, l, r;
			in >> tt >> l >> r;

			while (t < tt) {
				if (s < f) {
					out << 'R';
					p++;
				}
				else {
					out << 'L';
					p--;
				}

				if (s < f && p == f + 1) break;
				else if (s > f && p == f - 1) break;
				t++;
			}
			if (s < f && p == f + 1) break;
			else if (s > f && p == f - 1) break;
			else if (p <= r && p >= l) {
				out << 'X';
				t++;
				continue;
			}

		}

	}
};

void solve(std::istream& in, std::ostream& out)
{
    out << fixed << std::setprecision(6);
    Solution solution;
    solution.solve(in, out);
}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    istream& in = cin;

    ostream& out = cout;

    solve(in, out);
    return 0;
}


/*
 * In The Name Of ALLAH
 * created by Harolinch
 * NOTES:
 */
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <list>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <numeric>

#include <math.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <memory.h>
#include <ctype.h>
#include <string.h>
using namespace std;

class Solution {
public:

	void solve(std::istream& in, std::ostream& out) {
		int n, m, s, f;
		in >> n >> m >> s >> f;

		int t = 1, tt, l, r;
		while (m--) {
			in >> tt >> l >> r;

			while (t < tt && s != f) {
				if (s < f) {
					out << 'R';
					s++;
				}
				else {
					out << 'L';
					s--;
				}
				t++;
			}
			if (t == tt && s != f) {
				int to = s < f ? s + 1 : s - 1;
				if ((s <= r && s >= l) || (to <= r && to >= l)) out << 'X';
				else {
					if (s < f) {
						out << 'R';
						s++;
					}
					else {
						out << 'L';
						s--;
					}
				}
				t++;
			}
			if (s == f) break;
		}
		while (s != f) {
			if (s < f) {
				out << 'R';
				s++;
			}
			else {
				out << 'L';
				s--;
			}
		}

	}
};

void solve(std::istream& in, std::ostream& out)
{
    out << fixed << std::setprecision(6);
    Solution solution;
    solution.solve(in, out);
}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    istream& in = cin;

    ostream& out = cout;

    solve(in, out);
    return 0;
}


/*
 * In The Name Of ALLAH
 * created by Harolinch
 * NOTES:
 */
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <list>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <numeric>

#include <math.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <memory.h>
#include <ctype.h>
#include <string.h>
using namespace std;

class Solution {
public:

	void solve(std::istream& in, std::ostream& out) {
		int n, m, s, f;
		in >> n >> m >> s >> f;

		int t = 1, tt, l, r;
		while (m--) {
			in >> tt >> l >> r;

			while (t < tt && s != f) {
				if (s < f) {
					out << 'R';
					s++;
				}
				else {
					out << 'L';
					s--;
				}
				t++;
			}
			if (t == tt && s != f) {
				int to = s < f ? s + 1 : s - 1;
				if ((s <= r && s >= l) || (to <= r && to >= l)) out << 'X';
				else {
					if (s < f) {
						out << 'R';
						s++;
					}
					else {
						out << 'L';
						s--;
					}
				}
				t++;
			}
			if (s == f) break;
		}

	}
};

void solve(std::istream& in, std::ostream& out)
{
    out << fixed << std::setprecision(6);
    Solution solution;
    solution.solve(in, out);
}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    istream& in = cin;

    ostream& out = cout;

    solve(in, out);
    return 0;
}


/*
 * In The Name Of ALLAH
 * created by Harolinch
 * NOTES:
 */
#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <list>
#include <vector>
#include <stack>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <numeric>

#include <math.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <memory.h>
#include <ctype.h>
#include <string.h>
using namespace std;

class Solution {
public:

	void solve(std::istream& in, std::ostream& out) {
		int n, m, s, f;
		in >> n >> m >> s >> f;

		int p;
		if (s < f) p = s + 1;
		else p = s - 1;
		int t = 1;
		while (m--) {
			int tt, l, r;
			in >> tt >> l >> r;
			if (s < f && p == f + 1) break;
			else if (s > f && p == f - 1) break;
			if (t == tt && p <= r && p >= l) {
				out << 'X';
				t++;
				continue;
			}
			while (t < tt) {
				if (s < f) {
					out << 'R';
					p++;
				}
				else{
					out << 'L';
					p--;
				}

				if (s < f && p == f + 1) break;
				else if (s > f && p == f - 1) break;
				t++;
			}
		}

	}
};

void solve(std::istream& in, std::ostream& out)
{
    out << fixed << std::setprecision(6);
    Solution solution;
    solution.solve(in, out);
}

int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);

    istream& in = cin;

    ostream& out = cout;

    solve(in, out);
    return 0;
}


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

int main() {
	int n,m,s,f;
	cin>>n>>m>>s>>f;
	string a = "";
	int ti = 1;
	while(m>0 && s!=f)
	{
		int t,l,r;
		cin>>t;
		if(ti==t)
		{
			cin>>l>>r;
			if(l<=s && s<=r)
			{
				a+='X';
			}
			else if(f>s)
			{
				if(l<=s+1 && s+1<=r)
				{
					a+='X';
				}
				else{
					a+='R';
					s++;
					if(s==f)
					{
						cout<<a;
						return 0;
					}
				}
			}
			else{
				if(l<=s-1 && s-1<=r)
				{
					a+='X';
				}
				else{
					a+='L';
					s--;
					if(s==f)
					{
						cout<<a;
						return 0;
					}
				}
			}
			ti++;
		}
		else{
			while(ti!=t)
			{
				if(f>s)
				{
					a+='R';
					s++;
				}
				else if(f<s){
					a+='L';
					s--;
				}
				if(s==f){
					cout<<a;
					return 0;
				}
				ti++;
			}
		}
		m--;
	}
	while(s!=f)
	{
		if(f>s)
		{
			a+='R';
			s++;
		}
		else if(f<s){
			a+='L';
			s--;
		}
		if(s==f){
			cout<<a;
			return 0;
		}
	}
	return 0;
}


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

int main() {
	int n,m,s,f;
	cin>>n>>m>>s>>f;
	string a = "";
	char x = 'X';
	char y;
	if(f>s)
	{
		y = 'R';
	}
	else if(f<s){
		y = 'L';
	}
	while(m>0)
	{
		int t,l,r;
		cin>>t>>l>>r;
		if(l<=s && s<=r)
		{
			a+=x;
		}
		else if(y=='R')
		{
			if(l<=s+1 && s+1<=r)
			{
				a+=x;
			}
			else{
				a+=y;
				s++;
			}
		}
		else{
			if(l<=s-1 && s-1<=r)
			{
				a+=x;
			}
			else{
				a+=y;
				s--;
			}
		}
		if(s==f)
		{
			break;
		}
		m--;
	}
	cout<<a;
	return 0;
}


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

int main() {
	int n,m,s,f;
	cin>>n>>m>>s>>f;
	string a = "";
	char x = 'X';
	char y;
	if(f>s)
	{
		y = 'R';
	}
	else if(f<s){
		y = 'L';
	}
	vector<int> t(m);
	int i = 0;
	while(m>0)
	{
		int l,r;
		cin>>t[i]>>l>>r;
		if(i==0 || t[i]==t[i-1]+1)
		{
			if(l<=s && s<=r)
			{
				a+=x;
			}
			else if(y=='R')
			{
				if(l<=s+1 && s+1<=r)
				{
					a+=x;
				}
				else{
					a+=y;
					s++;
				}
			}
			else{
				if(l<=s-1 && s-1<=r)
				{
					a+=x;
				}
				else{
					a+=y;
					s--;
				}
			}
		}
		else{
			a+=y;
		}
		if(s==f)
		{
			break;
		}
		m--;
		i++;
	}
	cout<<a;
	return 0;
}


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

int main() {
	int n,m,s,f;
	cin>>n>>m>>s>>f;
	string a = "";
	char x = 'X';
	char y;
	if(f>s)
	{
		y = 'R';
	}
	else if(f<s){
		y = 'L';
	}
	int t1 = 1;
	while(m>0)
	{
		int t,l,r;
		cin>>t;
X:		if(t1==t)
		{
			cin>>l>>r;
			if(s==f)
			{
				break;
			}
			if(l<=s && s<=r)
			{
				a+=x;
			}
			else if(y=='R')
			{
				if(l<=s+1 && s+1<=r)
				{
					a+=x;
				}
				else{
					a+=y;
					s++;
				}
			}
			else{
				if(l<=s-1 && s-1<=r)
				{
					a+=x;
				}
				else{
					a+=y;
					s--;
				}
			}
		}
		else{
			a+=y;
			if(y=='R')
			{
				s++;
			}
			else{
				s--;
			}
			t1++;
			goto X;
		}
		if(s==f)
		{
			break;
		}
		m--;
		t1++;
	}
	cout<<a;
	return 0;
}


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

int main() {
	int n,m,s,f;
	cin>>n>>m>>s>>f;
	string a = "";
	char x = 'X';
	char y;
	if(f>s)
	{
		y = 'R';
	}
	else if(f<s){
		y = 'L';
	}
	int t1 = 1;
	while(m>0)
	{
		int t,l,r;
		cin>>t;
X:		if(t1==t)
		{
			cin>>l>>r;
			if(s==f)
			{
				break;
			}
			if(l<=s && s<=r)
			{
				a+=x;
			}
			else if(y=='R')
			{
				if(l<=s+1 && s+1<=r)
				{
					a+=x;
				}
				else{
					a+=y;
					s++;
				}
			}
			else{
				if(l<=s-1 && s-1<=r)
				{
					a+=x;
				}
				else{
					a+=y;
					s--;
				}
			}
		}
		else{
			a+=y;
			if(y=='R')
			{
				s++;
			}
			else{
				s--;
			}
			t1++;
			goto X;
		}
		m--;
		t1++;
	}
	cout<<a;
	return 0;
}